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

Derive.ScoreT

Description

Low-dependency basic types for derivation.

Synopsis

Documentation

newtype Instrument Source #

An Instrument is identified by a plain string. This will be looked up in the instrument db to get the backend specific Instrument type as well as the backend itself, but things at the Derive layer and above don't care about all that.

This should be a valid symbol as defined by valid_symbol. This way it can be parsed without quotes.

Constructors

Instrument Text 

Instances

Instances details
Eq Instrument # 
Instance details

Defined in Derive.ScoreT

Ord Instrument # 
Instance details

Defined in Derive.ScoreT

Read Instrument # 
Instance details

Defined in Derive.ScoreT

Show Instrument # 
Instance details

Defined in Derive.ScoreT

String.IsString Instrument # 
Instance details

Defined in Derive.ScoreT

DeepSeq.NFData Instrument # 
Instance details

Defined in Derive.ScoreT

Methods

rnf :: Instrument -> () #

Hashable Instrument # 
Instance details

Defined in Derive.ScoreT

Pretty.Pretty Instrument # 
Instance details

Defined in Derive.ScoreT

Serialize.Serialize Instrument # 
Instance details

Defined in Derive.ScoreT

ShowVal.ShowVal Instrument # 
Instance details

Defined in Derive.ScoreT

ToVal Instrument # 
Instance details

Defined in Derive.RestrictedEnviron

ToVal Instrument # 
Instance details

Defined in Derive.Typecheck

Typecheck Instrument # 
Instance details

Defined in Derive.Typecheck

Control

newtype Control Source #

A control is an abstract parameter that influences derivation. Some of them affect performance and will be rendered as MIDI controls or note parameters or whatever, while others may affect derivation (e.g. tempo) and won't be seen by the backend at all.

A Control should be a valid identifier as defined by valid_symbol.

Constructors

Control Text 

Instances

Instances details
Eq Control # 
Instance details

Defined in Derive.ScoreT

Methods

(==) :: Control -> Control -> Bool #

(/=) :: Control -> Control -> Bool #

Ord Control # 
Instance details

Defined in Derive.ScoreT

Read Control # 
Instance details

Defined in Derive.ScoreT

Show Control # 
Instance details

Defined in Derive.ScoreT

String.IsString Control # 
Instance details

Defined in Derive.ScoreT

DeepSeq.NFData Control # 
Instance details

Defined in Derive.ScoreT

Methods

rnf :: Control -> () #

Pretty.Pretty Control # 
Instance details

Defined in Derive.ScoreT

Pretty.Pretty ControlRef # 
Instance details

Defined in Derive.DeriveT

Serialize.Serialize Control # 
Instance details

Defined in Derive.ScoreT

ShowVal.ShowVal Control # 
Instance details

Defined in Derive.ScoreT

ShowVal.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

ToVal ControlRef # 
Instance details

Defined in Derive.RestrictedEnviron

ToVal Control # 
Instance details

Defined in Derive.Typecheck

Methods

to_val :: Control -> Val Source #

ToVal ControlRef # 
Instance details

Defined in Derive.Typecheck

Typecheck Control # 
Instance details

Defined in Derive.Typecheck

Typecheck ControlRef #

Use a TypedFunction or Function instead of this.

Instance details

Defined in Derive.Typecheck

ShowVal.ShowVal (Typed Control) # 
Instance details

Defined in Derive.ScoreT

control :: Text -> Either Text Control Source #

Use this constructor when making a Control from user input. Literals can use the IsString instance.

PControl

newtype PControl Source #

The pitch control version of Control. Unlike Control, this is allowed to be null, which is the name of the default pitch signal.

A PControl should be a valid identifier as defined by valid_symbol, except that its literal tracklang form starts with a #, to differentiate from a Control.

Constructors

PControl Text 

Instances

Instances details
Eq PControl # 
Instance details

Defined in Derive.ScoreT

Ord PControl # 
Instance details

Defined in Derive.ScoreT

Read PControl # 
Instance details

Defined in Derive.ScoreT

Show PControl # 
Instance details

Defined in Derive.ScoreT

String.IsString PControl # 
Instance details

Defined in Derive.ScoreT

DeepSeq.NFData PControl # 
Instance details

Defined in Derive.ScoreT

Methods

rnf :: PControl -> () #

Pretty.Pretty PControl # 
Instance details

Defined in Derive.ScoreT

Pretty.Pretty PControlRef # 
Instance details

Defined in Derive.DeriveT

Serialize.Serialize PControl # 
Instance details

Defined in Derive.ScoreT

ShowVal.ShowVal PControl # 
Instance details

Defined in Derive.ScoreT

ShowVal.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

ToVal PControl # 
Instance details

Defined in Derive.Typecheck

Methods

to_val :: PControl -> Val Source #

ToVal PControlRef # 
Instance details

Defined in Derive.Typecheck

Typecheck PControl # 
Instance details

Defined in Derive.Typecheck

Typecheck PControlRef # 
Instance details

Defined in Derive.Typecheck

pcontrol :: Text -> Either Text PControl Source #

Use this constructor when making a PControl from user input. Literals can use the IsString instance.

parse_generic_control :: Text -> Either Text (Either Control PControl) Source #

Parse either a Control or PControl.

Type

data Type Source #

Tag for the type of the values in a control signal.

Constructors

Untyped 
Chromatic 
Diatonic 
Nn 
Score 
Real 

Instances

Instances details
Enum Type # 
Instance details

Defined in Derive.ScoreT

Methods

succ :: Type -> Type #

pred :: Type -> Type #

toEnum :: Int -> Type #

fromEnum :: Type -> Int #

enumFrom :: Type -> [Type] #

enumFromThen :: Type -> Type -> [Type] #

enumFromTo :: Type -> Type -> [Type] #

enumFromThenTo :: Type -> Type -> Type -> [Type] #

Eq Type # 
Instance details

Defined in Derive.ScoreT

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type # 
Instance details

Defined in Derive.ScoreT

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Read Type # 
Instance details

Defined in Derive.ScoreT

Show Type # 
Instance details

Defined in Derive.ScoreT

Semigroup Type # 
Instance details

Defined in Derive.ScoreT

Methods

(<>) :: Type -> Type -> Type #

sconcat :: NonEmpty Type -> Type #

stimes :: Integral b => b -> Type -> Type #

Monoid Type # 
Instance details

Defined in Derive.ScoreT

Methods

mempty :: Type #

mappend :: Type -> Type -> Type #

mconcat :: [Type] -> Type #

Pretty.Pretty Type # 
Instance details

Defined in Derive.ScoreT

Serialize.Serialize Type # 
Instance details

Defined in Derive.ScoreT

data Typed a Source #

Constructors

Typed 

Fields

Instances

Instances details
Functor Typed # 
Instance details

Defined in Derive.ScoreT

Methods

fmap :: (a -> b) -> Typed a -> Typed b #

(<$) :: a -> Typed b -> Typed a #

Pretty.Pretty ControlRef # 
Instance details

Defined in Derive.DeriveT

ShowVal.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

ToVal ControlRef # 
Instance details

Defined in Derive.RestrictedEnviron

ToVal ControlRef # 
Instance details

Defined in Derive.Typecheck

Typecheck ControlRef #

Use a TypedFunction or Function instead of this.

Instance details

Defined in Derive.Typecheck

Typecheck TypedFunction # 
Instance details

Defined in Derive.Typecheck

Eq a => Eq (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

(==) :: Typed a -> Typed a -> Bool #

(/=) :: Typed a -> Typed a -> Bool #

Ord a => Ord (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

compare :: Typed a -> Typed a -> Ordering #

(<) :: Typed a -> Typed a -> Bool #

(<=) :: Typed a -> Typed a -> Bool #

(>) :: Typed a -> Typed a -> Bool #

(>=) :: Typed a -> Typed a -> Bool #

max :: Typed a -> Typed a -> Typed a #

min :: Typed a -> Typed a -> Typed a #

Read a => Read (Typed a) # 
Instance details

Defined in Derive.ScoreT

Show a => Show (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

showsPrec :: Int -> Typed a -> ShowS #

show :: Typed a -> String.String #

showList :: [Typed a] -> ShowS #

Semigroup a => Semigroup (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

(<>) :: Typed a -> Typed a -> Typed a #

sconcat :: NonEmpty (Typed a) -> Typed a #

stimes :: Integral b => b -> Typed a -> Typed a #

(Semigroup a, Monoid a) => Monoid (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

mempty :: Typed a #

mappend :: Typed a -> Typed a -> Typed a #

mconcat :: [Typed a] -> Typed a #

DeepSeq.NFData a => DeepSeq.NFData (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

rnf :: Typed a -> () #

Pretty.Pretty a => Pretty.Pretty (Typed a) # 
Instance details

Defined in Derive.ScoreT

Serialize.Serialize a => Serialize.Serialize (Typed a) # 
Instance details

Defined in Derive.ScoreT

Methods

put :: Putter (Typed a) Source #

get :: Get (Typed a) Source #

ShowVal.ShowVal (Typed Signal.Y) # 
Instance details

Defined in Derive.ScoreT

ShowVal.ShowVal (Typed Control) # 
Instance details

Defined in Derive.ScoreT

TypecheckNum (Typed Signal.Y) # 
Instance details

Defined in Derive.Typecheck

ToVal (Typed Signal.Y) # 
Instance details

Defined in Derive.Typecheck

Typecheck (Typed Signal.Y) # 
Instance details

Defined in Derive.Typecheck

merge_typed :: (a -> a -> a) -> Typed a -> Typed a -> Typed a Source #

untyped :: a -> Typed a Source #

ControlMap

type ControlValMap = Map Control Signal.Y Source #

This is a snapshot of the control signals at a certain point in time. It's meant for PitchConfig, so the values are expected to be transpositions, and hence untyped.