Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Derive.ShowVal

Description

The show_val method turns haskell values back to tracklang expressions. It should be the inverse of from_val . parse_val.

Synopsis

Documentation

class ShowVal a where Source #

Instances of ShowVal can be turned back into tracklang syntax. Everything produced by show_val should be parseable by Derive.Parse, except values that have no literal syntax, such as VPitch.

At least one place that relies on this is inverting.

Minimal complete definition

Nothing

Methods

show_val :: a -> Text Source #

default show_val :: (Show a, Enum a, Bounded a) => a -> Text Source #

Instances

Instances details
ShowVal Bool # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: Bool -> Text Source #

ShowVal Double # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: Double -> Text Source #

ShowVal Int # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: Int -> Text Source #

ShowVal Text #

This should be the inverse of p_str and p_unquoted_str.

Instance details

Defined in Derive.ShowVal

Methods

show_val :: Text -> Text Source #

ShowVal Highlight # 
Instance details

Defined in Derive.C.Prelude.Highlight

ShowVal ScoreTime # 
Instance details

Defined in Ui.ScoreTime

ShowVal RealTime # 
Instance details

Defined in Perform.RealTime

ShowVal Key # 
Instance details

Defined in Perform.Pitch

Methods

show_val :: Key -> Text Source #

ShowVal Transpose # 
Instance details

Defined in Perform.Pitch

ShowVal NoteNumber # 
Instance details

Defined in Perform.Pitch

ShowVal Pitch #

This relies on the presence of a pitch val call.

Instance details

Defined in Perform.Pitch

Methods

show_val :: Pitch -> Text Source #

ShowVal Attributes # 
Instance details

Defined in Derive.Attrs

ShowVal RankName # 
Instance details

Defined in Derive.Typecheck

ShowVal PControl # 
Instance details

Defined in Derive.ScoreT

ShowVal Control # 
Instance details

Defined in Derive.ScoreT

ShowVal Instrument # 
Instance details

Defined in Derive.ScoreT

ShowVal MiniVal # 
Instance details

Defined in Derive.Expr

ShowVal Str # 
Instance details

Defined in Derive.Expr

Methods

show_val :: Str -> Text Source #

ShowVal Symbol # 
Instance details

Defined in Derive.Expr

Methods

show_val :: Symbol -> Text Source #

ShowVal ControlFunction #

Not parseable.

Instance details

Defined in Derive.DeriveT

ShowVal PControlRef #

There's no way to convert a pitch back into the expression that produced it, so this is the best I can do.

Similar to ShowVal ControlRef, there's no signal literal so I use the value at 0. A pitch can be turned into an expression, but not necessarily accurately since it doesn't take things like pitch interpolation into account.

Instance details

Defined in Derive.DeriveT

ShowVal ControlRef #

This can only represent constant signals, since there's no literal for an arbitrary signal. Non-constant signals will turn into a constant of whatever was at 0.

Instance details

Defined in Derive.DeriveT

ShowVal Quoted #

Unlike Exprs in general, a Quoted Expr should be representable with show_val. This is because a Quoted has only been parsed, not evaluated, so it shouldn't have anything unshowable, like pitches.

Instance details

Defined in Derive.DeriveT

Methods

show_val :: Quoted -> Text Source #

ShowVal Val #

This instance is actually invalid due to showing VPitch, which has no literal, and for Val, showing PControlRef, which amounts to the same thing. I use this to treat any Val as a Str to re-evaluate it. Being invalid means that a VPitch or VPControlRef with a default will cause a parse failure, but I'll have to see if this becomes a problem in practice.

Instance details

Defined in Derive.DeriveT

Methods

show_val :: Val -> Text Source #

ShowVal Duration # 
Instance details

Defined in Derive.DeriveT

ShowVal Var # 
Instance details

Defined in Derive.Parse

Methods

show_val :: Var -> Text Source #

ShowVal Term # 
Instance details

Defined in Derive.Parse

Methods

show_val :: Term -> Text Source #

ShowVal Call # 
Instance details

Defined in Derive.Parse

Methods

show_val :: Call -> Text Source #

ShowVal Expr # 
Instance details

Defined in Derive.Parse

Methods

show_val :: Expr -> Text Source #

ShowVal ControlType # 
Instance details

Defined in Derive.ParseTitle

ShowVal Merger # 
Instance details

Defined in Derive.Deriver.Monad

Methods

show_val :: Merger -> Text Source #

ShowVal PitchDeriver # 
Instance details

Defined in Derive.Deriver.Monad

ShowVal ControlDeriver # 
Instance details

Defined in Derive.Deriver.Monad

ShowVal NoteDeriver #

This is an invalid instance, because a deriver has no literal syntax. But this lets me put a deriver in a defaulted argument, and get documentation for it.

Instance details

Defined in Derive.Deriver.Monad

ShowVal DefaultDiatonic # 
Instance details

Defined in Derive.Typecheck

ShowVal NormalizedBipolar # 
Instance details

Defined in Derive.Typecheck

ShowVal Normalized # 
Instance details

Defined in Derive.Typecheck

ShowVal DefaultScore # 
Instance details

Defined in Derive.Typecheck

ShowVal DefaultReal # 
Instance details

Defined in Derive.Typecheck

ShowVal FreeCodePosition # 
Instance details

Defined in Perform.Lilypond.Constants

ShowVal UpDown # 
Instance details

Defined in Derive.Call

Methods

show_val :: UpDown -> Text Source #

ShowVal Speed # 
Instance details

Defined in Derive.Call.Speed

Methods

show_val :: Speed -> Text Source #

ShowVal Distribution # 
Instance details

Defined in Derive.C.Prelude.ControlFunction

ShowVal Stroke # 
Instance details

Defined in Derive.C.India.Mridangam

Methods

show_val :: Stroke -> Text Source #

ShowVal KotekanStyle # 
Instance details

Defined in Derive.C.Bali.Gangsa

ShowVal NorotStyle # 
Instance details

Defined in Derive.C.Bali.Gangsa

ShowVal Tuning # 
Instance details

Defined in Derive.Scale.BaliScales

Methods

show_val :: Tuning -> Text Source #

ShowVal HarmonicType # 
Instance details

Defined in Derive.C.Prelude.Articulation

ShowVal Adjust # 
Instance details

Defined in Derive.C.Prelude.Trill

Methods

show_val :: Adjust -> Text Source #

ShowVal Direction # 
Instance details

Defined in Derive.C.Prelude.Trill

ShowVal a => ShowVal [a] # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: [a] -> Text Source #

ShowVal a => ShowVal (Maybe a) # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: Maybe a -> Text Source #

ShowVal (Ratio.Ratio Int) # 
Instance details

Defined in Derive.ShowVal

ShowVal a => ShowVal (Set a) # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: Set a -> Text Source #

ShowVal (Typed Y) # 
Instance details

Defined in Derive.ScoreT

Methods

show_val :: Typed Y -> Text Source #

ShowVal (Typed Control) # 
Instance details

Defined in Derive.ScoreT

ShowVal (Term Text) # 
Instance details

Defined in Derive.Expr

Methods

show_val :: Term Text -> Text Source #

ShowVal (Term MiniVal) # 
Instance details

Defined in Derive.Expr

ShowVal (Term Val) # 
Instance details

Defined in Derive.DeriveT

Methods

show_val :: Term Val -> Text Source #

ShowVal (Call Text) # 
Instance details

Defined in Derive.Expr

Methods

show_val :: Call Text -> Text Source #

ShowVal (Call MiniVal) # 
Instance details

Defined in Derive.Expr

ShowVal (Call Val) # 
Instance details

Defined in Derive.DeriveT

Methods

show_val :: Call Val -> Text Source #

ShowVal (Expr Text) # 
Instance details

Defined in Derive.Expr

Methods

show_val :: Expr Text -> Text Source #

ShowVal (Expr MiniVal) # 
Instance details

Defined in Derive.Expr

ShowVal (Expr Val) # 
Instance details

Defined in Derive.DeriveT

Methods

show_val :: Expr Val -> Text Source #

ShowVal (RawPitch a) #

Pitches have no literal syntax, but I have to print something.

Instance details

Defined in Derive.DeriveT

Methods

show_val :: RawPitch a -> Text Source #

ShowVal a => ShowVal (NonNegative a) # 
Instance details

Defined in Derive.Typecheck

ShowVal a => ShowVal (Positive a) # 
Instance details

Defined in Derive.Typecheck

Methods

show_val :: Positive a -> Text Source #

ShowVal (Position CodePosition) # 
Instance details

Defined in Derive.Call.Ly

(ShowVal a, ShowVal b) => ShowVal (Either a b) # 
Instance details

Defined in Derive.ShowVal

Methods

show_val :: Either a b -> Text Source #

show_hex_val :: Double -> Text Source #

VNums have hex and decimal literals, and show_val produces the decimal one. So I need a way to produce the hex literal.

doc :: ShowVal a => a -> Doc.Doc Source #

Show a val for inclusion into CallDoc.