Safe Haskell | Safe-Inferred |
---|
Generic combinators for solkattu patterns. Because these are expected to
be called as part of the DSL, impure exceptions are allowed, via
Solkattu.throw
.
This is meant to have just Sequence manipulation, without instrument-specific functions.
Synopsis
- type SequenceT sollu = S.Sequence Solkattu.Group (Solkattu.Note sollu)
- class Rest a where
- __ :: a
- __2 :: SequenceT sollu
- __3 :: SequenceT sollu
- __4 :: SequenceT sollu
- __5 :: SequenceT sollu
- __6 :: SequenceT sollu
- __7 :: SequenceT sollu
- __8 :: SequenceT sollu
- __9 :: SequenceT sollu
- __n :: S.Matra -> SequenceT sollu
- __D :: CallStack.Stack => S.Duration -> SequenceT sollu
- __M :: S.Matra -> SequenceT sollu
- sarvaM :: CallStack.Stack => SequenceT sollu -> S.Matra -> SequenceT sollu
- sarvaD :: CallStack.Stack => SequenceT sollu -> S.Duration -> SequenceT sollu
- sarvaM_ :: CallStack.Stack => S.Matra -> SequenceT sollu
- sarvaD_ :: CallStack.Stack => S.Duration -> SequenceT sollu
- dropM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu
- dropM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu
- takeM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu
- splitM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> (SequenceT sollu, SequenceT sollu)
- splitM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> (SequenceT sollu, SequenceT sollu)
- splitM_either :: Pretty sollu => S.FMatra -> SequenceT sollu -> Either Text (SequenceT sollu, SequenceT sollu)
- rdropM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu
- rdropM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu
- rtakeM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu
- spaceM :: CallStack.Stack => Solkattu.Space -> S.FMatra -> SequenceT sollu
- restD :: CallStack.Stack => S.Duration -> SequenceT sollu
- spaceD :: CallStack.Stack => Solkattu.Space -> S.Tempo -> S.Duration -> SequenceT sollu
- dropD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu
- rdropD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu
- takeD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu
- rtakeD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu
- sandi :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- tri :: SequenceT sollu -> SequenceT sollu
- tri_ :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- tri_nomid :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- tri123 :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- trin :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- tri2 :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- tri2g :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- tsep :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- repeat :: Monoid a => Int -> a -> a
- r2 :: Monoid a => a -> a
- r3 :: Monoid a => a -> a
- r4 :: Monoid a => a -> a
- r5 :: Monoid a => a -> a
- r6 :: Monoid a => a -> a
- r7 :: Monoid a => a -> a
- r8 :: Monoid a => a -> a
- join :: SequenceT sollu -> [SequenceT sollu] -> SequenceT sollu
- inter :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- spread :: S.Matra -> SequenceT sollu -> SequenceT sollu
- cmap :: Monoid b => (a -> b) -> [a] -> b
- for :: [a] -> (a -> b) -> [b]
- cfor :: Monoid b => [a] -> (a -> b) -> b
- prefixes :: (Semigroup a, Monoid a) => [a] -> a -> a
- suffixes :: (Semigroup a, Monoid a) => a -> [a] -> a
- circum :: (Semigroup a, Monoid a) => a -> [a] -> a -> a
- suffix :: (Semigroup a, Monoid a) => [a] -> a -> a
- prefix :: (Semigroup a, Monoid a) => a -> [a] -> a
- accumulate :: Monoid a => [a] -> [a]
- reduce3 :: Pretty sollu => S.FMatra -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- reduceBy :: Pretty sollu => [S.FMatra] -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- reduceTo :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> SequenceT sollu
- reduceToL :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> [SequenceT sollu]
- reduceToR :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> [SequenceT sollu]
- expand :: (CallStack.Stack, Pretty sollu) => Int -> S.FMatra -> SequenceT sollu -> [SequenceT sollu]
- replaceStart :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- replaceEnd :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- (<==) :: Pretty sollu => SequenceT sollu -> S.Duration -> SequenceT sollu
- (==>) :: Pretty sollu => S.Duration -> SequenceT sollu -> SequenceT sollu
- matrasOf :: SequenceT sollu -> S.FMatra
- matrasOfI :: CallStack.Stack => SequenceT sollu -> S.Matra
- matraDuration :: S.Duration
- dToM :: S.Duration -> S.FMatra
- dToM2 :: CallStack.Stack => S.Nadai -> S.Duration -> S.Matra
- speed :: S.Speed -> S.Sequence g sollu -> S.Sequence g sollu
- su :: S.Sequence g sollu -> S.Sequence g sollu
- sd :: S.Sequence g sollu -> S.Sequence g sollu
- su2 :: S.Sequence g sollu -> S.Sequence g sollu
- sd2 :: S.Sequence g sollu -> S.Sequence g sollu
- nadai :: S.Matra -> S.Sequence g sollu -> S.Sequence g sollu
- stride :: S.Stride -> S.Sequence g sollu -> S.Sequence g sollu
- group :: SequenceT sollu -> SequenceT sollu
- g :: SequenceT sollu -> SequenceT sollu
- pattern :: SequenceT sollu -> SequenceT sollu
- reduction :: S.FMatra -> Solkattu.Side -> SequenceT sollu -> SequenceT sollu
- named :: Text -> SequenceT sollu -> SequenceT sollu
- namedT :: Solkattu.GroupType -> Text -> SequenceT sollu -> SequenceT sollu
- checkD :: S.Duration -> SequenceT sollu -> SequenceT sollu
- _groupWith :: Solkattu.Meta -> SequenceT sollu -> SequenceT sollu
- (^) :: Solkattu.Tag -> SequenceT sollu -> SequenceT sollu
- mid :: Solkattu.Tag
- setTag :: Solkattu.Tag -> SequenceT sollu -> SequenceT sollu
- trySetTag :: Solkattu.Tag -> SequenceT sollu -> SequenceT sollu
- __sam :: (CallStack.Stack, Pretty sollu) => Tala.Tala -> SequenceT sollu -> SequenceT sollu
- nextSam :: Tala.Tala -> SequenceT sollu -> S.Duration
- __a :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu
- sarvaSam :: (CallStack.Stack, Pretty sollu) => Tala.Tala -> SequenceT sollu -> SequenceT sollu
- sarvaA :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> S.Duration -> SequenceT sollu -> SequenceT sollu
- sarvaA_ :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu
- in3 :: SequenceT sollu -> SequenceT sollu
- appendEach :: Int -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu
- mapGroup :: forall state g a. (state -> a -> (state, [S.Note g a])) -> state -> S.Sequence g a -> S.Sequence g a
- byGroup :: [S.Note g a] -> Maybe [Either (g, [S.Note g a]) [a]]
Documentation
type SequenceT sollu = S.Sequence Solkattu.Group (Solkattu.Note sollu) Source #
This is the same as SequenceT
.
rests
Instances
Rest (SequenceT sollu) Source # | |
Defined in Solkattu.Dsl.Notation | |
Rest (Realize.SNote sollu) Source # | |
Defined in Solkattu.Dsl.Notation __ :: Realize.SNote sollu Source # | |
Rest (Solkattu.Note sollu) Source # | |
Defined in Solkattu.Dsl.Notation __ :: Solkattu.Note sollu Source # |
__2 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__3 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__4 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__5 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__6 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__7 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__8 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__9 :: SequenceT sollu Source #
These are meant to suffix a sollu. Since the sollu is considered part of
the duration, the number is one higher than the number of rests. E.g.
din.__3
is a 3 count, and equivalent to din..
. __M
is the version
that doesn't do this.
__D :: CallStack.Stack => S.Duration -> SequenceT sollu Source #
sarvaD :: CallStack.Stack => SequenceT sollu -> S.Duration -> SequenceT sollu Source #
sarvaD_ :: CallStack.Stack => S.Duration -> SequenceT sollu Source #
by FMatra
dropM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #
splitM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> (SequenceT sollu, SequenceT sollu) Source #
Like splitM_
, but mark the sequences as groups. This way they remember
the sollus which were dropped, and realize using the complete sequence, not
the fragment.
TODO the class constraints are unnecessary, but if I want to verify eagerly I'll need them back.
splitM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> (SequenceT sollu, SequenceT sollu) Source #
Split the sequence at the given FMatra. Unlike splitM
, this directly
splits the sequence, it doesn't create a group.
splitM_either :: Pretty sollu => S.FMatra -> SequenceT sollu -> Either Text (SequenceT sollu, SequenceT sollu) Source #
rdropM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #
rdropM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #
rtakeM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #
spaceM :: CallStack.Stack => Solkattu.Space -> S.FMatra -> SequenceT sollu Source #
by Duration
restD :: CallStack.Stack => S.Duration -> SequenceT sollu Source #
spaceD :: CallStack.Stack => Solkattu.Space -> S.Tempo -> S.Duration -> SequenceT sollu Source #
dropD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #
Duration-using variants of the matra functions. These are only valid
at the top level, in S.defaultTempo
. TODO require Tempo arg?
rdropD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #
Duration-using variants of the matra functions. These are only valid
at the top level, in S.defaultTempo
. TODO require Tempo arg?
takeD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #
Duration-using variants of the matra functions. These are only valid
at the top level, in S.defaultTempo
. TODO require Tempo arg?
rtakeD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #
Duration-using variants of the matra functions. These are only valid
at the top level, in S.defaultTempo
. TODO require Tempo arg?
structures
sandi :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Drop sollus equal in length to some others. This is intenedd for
repeated sequences that get elided away, e.g. tri p7 . sandi p7 (p7.p6.p5)
.
I considered an annotation that automatically drops stuff from before which matches stuff afterwards, but it seemed more complicated and less reliable than just dropping explicitly.
tri_ :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Repeat thrice, with the given separator. The _nomid variant doesn't
add the mid
tag, which is useful for nested calls.
tri_nomid :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Repeat thrice, with the given separator. The _nomid variant doesn't
add the mid
tag, which is useful for nested calls.
trin :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Three different patterns with the same separator.
tri2 :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Tirmanams with a variant final repeat.
tsep :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
tri_
with variable separators.
sequences
inter :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Intersperse between each stroke. TODO won't look inside a group
accumulate :: Monoid a => [a] -> [a] Source #
Succesively accumulate suffixes.
combinators
reduce3 :: Pretty sollu => S.FMatra -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Reduce three times, with a separator.
reduceBy :: Pretty sollu => [S.FMatra] -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
reduceTo :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> SequenceT sollu Source #
reduceToL
, except mconcat the result.
reduceToL :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> [SequenceT sollu] Source #
Reduce by a duration until a final duration.
reduceToR :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> [SequenceT sollu] Source #
Like reduceToL
, but drop from the end instead of the front.
expand :: (CallStack.Stack, Pretty sollu) => Int -> S.FMatra -> SequenceT sollu -> [SequenceT sollu] Source #
Start fully reduced, and expand n times by the given duration.
replaceStart :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Unlike most other functions that drop from a sequence, this one doesn't make a group. Since these are used to construct a new sequence, it seems more confusing than helpful.
As with (and (==), this is higher precedence than (.), so paretheses
are needed: (a.b)
.replaceStart
xyz
replaceEnd :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Unlike most other functions that drop from a sequence, this one doesn't make a group. Since these are used to construct a new sequence, it seems more confusing than helpful.
As with (and (==), this is higher precedence than (.), so paretheses
are needed: (a.b)
.replaceStart
xyz
(<==) :: Pretty sollu => SequenceT sollu -> S.Duration -> SequenceT sollu infixl 8 Source #
Operators to embed a sequence at the beginning or end of sarvalaghu.
The precedence is such that sequences must be parenthesized:
(a.b) <== 8
. If it's lower than (.), then a.b <== 4 . c.d <== 4
is
still wrong. Since sometimes I want (.) to be tighter and sometimes looser,
I go for always looser and require parentheses, just like function calls.
But by being at 8, at least I can be below (^) and (§).
measurement
matrasOfI :: CallStack.Stack => SequenceT sollu -> S.Matra Source #
Like matrasOf
, but throw an error if it's not integral.
matraDuration :: S.Duration Source #
I think defaultTempo is ok because these functions are used on fragments.
dToM :: S.Duration -> S.FMatra Source #
dToM2 :: CallStack.Stack => S.Nadai -> S.Duration -> S.Matra Source #
generic notation
speed :: S.Speed -> S.Sequence g sollu -> S.Sequence g sollu Source #
Set relative speed.
su :: S.Sequence g sollu -> S.Sequence g sollu Source #
Mnemonic: speed up, slow down.
sd :: S.Sequence g sollu -> S.Sequence g sollu Source #
Mnemonic: speed up, slow down.
su2 :: S.Sequence g sollu -> S.Sequence g sollu Source #
sd2 :: S.Sequence g sollu -> S.Sequence g sollu Source #
nadai :: S.Matra -> S.Sequence g sollu -> S.Sequence g sollu Source #
stride :: S.Stride -> S.Sequence g sollu -> S.Sequence g sollu Source #
groups
pattern :: SequenceT sollu -> SequenceT sollu Source #
Mark a pattern group. These are like patterns, except with a specific realization.
_groupWith :: Solkattu.Meta -> SequenceT sollu -> SequenceT sollu Source #
tags
(^) :: Solkattu.Tag -> SequenceT sollu -> SequenceT sollu infix 9 Source #
Infix operator to Solkattu.Tag
all of the sollus it applies to.
align
__sam :: (CallStack.Stack, Pretty sollu) => Tala.Tala -> SequenceT sollu -> SequenceT sollu Source #
Align to the end of the avartanam, with rests.
This should only be used at the top level, since it gets the timing wrong under a tempo change.
__a :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #
Align to the end of the given number of aksharams.
sarvaSam :: (CallStack.Stack, Pretty sollu) => Tala.Tala -> SequenceT sollu -> SequenceT sollu Source #
sarvaA :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> S.Duration -> SequenceT sollu -> SequenceT sollu Source #
sarvaA_ :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #
complex transformation
appendEach :: Int -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #
Append a sequence after a number of syllables. This works across groups, but not tempo changes.
mapGroup :: forall state g a. (state -> a -> (state, [S.Note g a])) -> state -> S.Sequence g a -> S.Sequence g a Source #
Apply a stateful transformation within groups. Since the transformation is allowed to add or remove notes, this will throw if there is a TempoChange in there, since now we are changing an unknown amount of time.