Safe Haskell | Safe-Inferred |
---|
Synopsis
- type Error = Text
- type SNote stroke = S.Note () (Note stroke)
- data Note stroke
- = Note !(Stroke stroke)
- | Space !Solkattu.Space
- | Abstract !Solkattu.Meta
- | Alignment !Tala.Akshara
- mapStroke :: Applicative f => (Stroke a -> f (Stroke b)) -> Note a -> f (Note b)
- data Stroke stroke = Stroke {}
- data Emphasis
- toExpr :: Expr.ToExpr a => Stroke a -> Expr.Expr Expr.MiniVal
- noteOf :: Note a -> Maybe.Maybe (Stroke a)
- strokeOf :: Note a -> Maybe.Maybe a
- stroke :: stroke -> Stroke stroke
- rest :: SNote stroke
- strokeToSequence :: stroke -> S.Sequence g (Solkattu.Note (Stroke stroke))
- typeName :: Solkattu.GroupType -> Text
- doubleRest :: Char.Char
- data Warning = Warning (Maybe.Maybe Int) !Text
- checkAlignment :: Tala.Akshara -> S.Duration -> S.Duration -> [(S.Tempo, Note stroke)] -> Maybe.Maybe Warning
- checkDuration :: [Realized stroke] -> ([Realized stroke], [Warning])
- data StrokeMap sollu stroke = StrokeMap {
- smapSolluMap :: SolluMap sollu stroke
- smapSolluShadows :: [(SolluMapKey sollu, [Maybe.Maybe (Stroke stroke)])]
- smapPatternMap :: PatternMap stroke
- smapKeys :: StrokeMap sollu stroke -> Set (SolluMapKey sollu)
- strokeMap :: (Pretty.Pretty sollu, Ord sollu, Pretty.Pretty stroke) => PatternMap stroke -> [(S.Sequence g (Solkattu.Note sollu), S.Sequence g (Solkattu.Note (Stroke stroke)))] -> Either Error (StrokeMap sollu stroke)
- solkattuToRealize :: S.Sequence g (Solkattu.Note (Stroke stroke)) -> Either Error [S.Note () (Note stroke)]
- isInstrumentEmpty :: StrokeMap sollu stroke -> Bool
- data PatternMap stroke
- patternMap :: [(Solkattu.Pattern, S.Sequence () (Note stroke))] -> Either Error (PatternMap stroke)
- lookupPattern :: Solkattu.Pattern -> PatternMap stroke -> Maybe.Maybe [SNote stroke]
- type SolluMapKey sollu = (Maybe.Maybe Solkattu.Tag, [sollu])
- verifySolluKey :: Pretty.Pretty sollu => [S.Note g (Solkattu.Note sollu)] -> Either Error (SolluMapKey (Maybe.Maybe sollu))
- prettyKey :: Pretty.Pretty sollu => SolluMapKey sollu -> Text
- type RealizePattern tempo stroke = tempo -> Solkattu.Pattern -> Either Error [(tempo, Note stroke)]
- realizePattern :: PatternMap stroke -> RealizePattern S.Tempo stroke
- data Group stroke
- = GReduction !(Reduction stroke)
- | GMeta !Solkattu.Meta
- data Reduction stroke = Reduction {
- _dropped :: ![stroke]
- _side :: !Solkattu.Side
- realize :: (Pretty.Pretty sollu, Ord sollu) => StrokeMap Solkattu.Sollu stroke -> ToStrokes sollu stroke -> Tala.Akshara -> [S.Flat Solkattu.Group (Solkattu.Note sollu)] -> (UF.UntilFail Error (Realized stroke), Set (SolluMapKey sollu))
- realize_ :: (Pretty.Pretty sollu, Ord sollu) => RealizePattern S.Tempo stroke -> ToStrokes sollu stroke -> Tala.Akshara -> [S.Flat Solkattu.Group (Solkattu.Note sollu)] -> (UF.UntilFail Error (Realized stroke), Set (SolluMapKey sollu))
- formatError :: Solkattu.Notation a => UF.UntilFail Error (S.Flat g a) -> Either Error [S.Flat g a]
- data ToStrokes sollu stroke
- realizeStroke :: ToStrokes (Stroke stroke) stroke
- realizeSollu :: Ord sollu => SolluMap sollu stroke -> ToStrokes (Stroke sollu) stroke
- justifyLeft :: Int -> Char.Char -> Text -> Text
- textLength :: Text -> Int
- newtype SolluMap sollu stroke = SolluMap (Map (SolluMapKey sollu) [Maybe.Maybe (Stroke stroke)])
- solluMap :: (Pretty.Pretty stroke, Pretty.Pretty sollu, Ord sollu) => [(S.Sequence g (Solkattu.Note sollu), [SNote stroke])] -> Either Error (SolluMap sollu stroke, [(SolluMapKey sollu, [Maybe.Maybe (Stroke stroke)])])
- type Realized stroke = S.Flat (Group (Stroke stroke)) (Note stroke)
Documentation
type SNote stroke = S.Note () (Note stroke) Source #
The group is () because I don't need groups in the stroke map keys.
The Solkattu.Sollu
s have been reduced to concrete strokes.
Note !(Stroke stroke) | |
Space !Solkattu.Space | |
Abstract !Solkattu.Meta | A pattern that has been made abstract. This is a group that has been abstracted away. That means it can have a name, but also it doesn't have to have an integral matra duration. Since Abstract comes from Notes, the abstract duration is a series of 1-matra Abstracts, where each Note used to be. These are created at the Format level, not here. |
Alignment !Tala.Akshara | This is |
Instances
Foldable Note Source # | |
Defined in Solkattu.Realize fold :: Monoid m => Note m -> m # foldMap :: Monoid m => (a -> m) -> Note a -> m # foldMap' :: Monoid m => (a -> m) -> Note a -> m # foldr :: (a -> b -> b) -> b -> Note a -> b # foldr' :: (a -> b -> b) -> b -> Note a -> b # foldl :: (b -> a -> b) -> b -> Note a -> b # foldl' :: (b -> a -> b) -> b -> Note a -> b # foldr1 :: (a -> a -> a) -> Note a -> a # foldl1 :: (a -> a -> a) -> Note a -> a # elem :: Eq a => a -> Note a -> Bool # maximum :: Ord a => Note a -> a # | |
Traversable Note Source # | |
Functor Note Source # | |
Show stroke => Show (Note stroke) Source # | |
DeepSeq.NFData (Note stroke) Source # | |
Defined in Solkattu.Realize | |
Eq stroke => Eq (Note stroke) Source # | |
Rest (SNote sollu) Source # | |
Defined in Solkattu.Dsl.Notation | |
S.HasMatras (Note stroke) Source # | |
Solkattu.Notation stroke => Solkattu.Notation (Note stroke) Source # | |
Pretty.Pretty stroke => Pretty.Pretty (Note stroke) Source # | |
Instances
The emphasis will be propagated to the underlying stroke.
toExpr :: Expr.ToExpr a => Stroke a -> Expr.Expr Expr.MiniVal Source #
strokeOf :: Note a -> Maybe.Maybe a Source #
strokeToSequence :: stroke -> S.Sequence g (Solkattu.Note (Stroke stroke)) Source #
typeName :: Solkattu.GroupType -> Text Source #
doubleRest :: Char.Char Source #
Used to replace two rests.
checkAlignment
Stroke index and warning text.
checkAlignment :: Tala.Akshara -> S.Duration -> S.Duration -> [(S.Tempo, Note stroke)] -> Maybe.Maybe Warning Source #
Verify that the notes start and end at sam, and the given Alignments fall where expected.
checkDuration :: [Realized stroke] -> ([Realized stroke], [Warning]) Source #
Check Solkattu.GCheckDuration
, and filter them out.
StrokeMap
data StrokeMap sollu stroke Source #
Sollu to instrument stroke mapping.
I considered integrating both strokes and patterns into SolluMap, but
I kind of like how the types for SolluMap
and PatternMap
can be more
specific. Namely, SolluMap has only strokes and rests, because it gets
substituted for sollus, regardless of their rhythm, while PatternMap can
have tempo changes since they always substitute a single Solkattu.Note.
If I ever have a use for e.g. (taka.p5, ...) then I could reconsider.
StrokeMap | |
|
Instances
strokeMap :: (Pretty.Pretty sollu, Ord sollu, Pretty.Pretty stroke) => PatternMap stroke -> [(S.Sequence g (Solkattu.Note sollu), S.Sequence g (Solkattu.Note (Stroke stroke)))] -> Either Error (StrokeMap sollu stroke) Source #
Verify a list of pairs stroke map and put them in an StrokeMap
.
solkattuToRealize :: S.Sequence g (Solkattu.Note (Stroke stroke)) -> Either Error [S.Note () (Note stroke)] Source #
Stroke maps use Notes
, so they can use the same language in
Solkattu.Dsl. But since they don't go through a realization step
(being used to implement the realization step for sollus), I can directly
map them to Note
s before storing them in StrokeMap
.
isInstrumentEmpty :: StrokeMap sollu stroke -> Bool Source #
PatternMap
data PatternMap stroke Source #
This maps a Pattern
of a certain duration to a realization. The
S.Matra
s should the same duration as the the list in the default tempo.
This is enforced in the constructor patternMap
.
Instances
patternMap :: [(Solkattu.Pattern, S.Sequence () (Note stroke))] -> Either Error (PatternMap stroke) Source #
Make a PatternMap while checking that the durations match. Analogous to
solluMap
.
lookupPattern :: Solkattu.Pattern -> PatternMap stroke -> Maybe.Maybe [SNote stroke] Source #
SolluMap
type SolluMapKey sollu = (Maybe.Maybe Solkattu.Tag, [sollu]) Source #
verifySolluKey :: Pretty.Pretty sollu => [S.Note g (Solkattu.Note sollu)] -> Either Error (SolluMapKey (Maybe.Maybe sollu)) Source #
prettyKey :: Pretty.Pretty sollu => SolluMapKey sollu -> Text Source #
realize
type RealizePattern tempo stroke = tempo -> Solkattu.Pattern -> Either Error [(tempo, Note stroke)] Source #
realizePattern :: PatternMap stroke -> RealizePattern S.Tempo stroke Source #
This is the realized version of Solkattu.Group
. I retain the dropped
strokes so Solkattu.Technique can use them.
GReduction !(Reduction stroke) | |
GMeta !Solkattu.Meta |
Instances
Functor Group Source # | |
Show stroke => Show (Group stroke) Source # | |
Eq stroke => Eq (Group stroke) Source # | |
Ord stroke => Ord (Group stroke) Source # | |
Defined in Solkattu.Realize | |
Pretty.Pretty stroke => Pretty.Pretty (Group stroke) Source # | |
data Reduction stroke Source #
Reduction | |
|
Instances
Functor Reduction Source # | |
Show stroke => Show (Reduction stroke) Source # | |
Eq stroke => Eq (Reduction stroke) Source # | |
Ord stroke => Ord (Reduction stroke) Source # | |
Defined in Solkattu.Realize compare :: Reduction stroke -> Reduction stroke -> Ordering # (<) :: Reduction stroke -> Reduction stroke -> Bool # (<=) :: Reduction stroke -> Reduction stroke -> Bool # (>) :: Reduction stroke -> Reduction stroke -> Bool # (>=) :: Reduction stroke -> Reduction stroke -> Bool # max :: Reduction stroke -> Reduction stroke -> Reduction stroke # min :: Reduction stroke -> Reduction stroke -> Reduction stroke # | |
Pretty.Pretty stroke => Pretty.Pretty (Reduction stroke) Source # | |
realize :: (Pretty.Pretty sollu, Ord sollu) => StrokeMap Solkattu.Sollu stroke -> ToStrokes sollu stroke -> Tala.Akshara -> [S.Flat Solkattu.Group (Solkattu.Note sollu)] -> (UF.UntilFail Error (Realized stroke), Set (SolluMapKey sollu)) Source #
realize_ :: (Pretty.Pretty sollu, Ord sollu) => RealizePattern S.Tempo stroke -> ToStrokes sollu stroke -> Tala.Akshara -> [S.Flat Solkattu.Group (Solkattu.Note sollu)] -> (UF.UntilFail Error (Realized stroke), Set (SolluMapKey sollu)) Source #
formatError :: Solkattu.Notation a => UF.UntilFail Error (S.Flat g a) -> Either Error [S.Flat g a] Source #
ToStroke
realizeStroke :: ToStrokes (Stroke stroke) stroke Source #
If the sollu and stroke are the same, I can just copy the sollu. This is for "monomorphic" single instrument scores, such as for mridangam.
realizeSollu :: Ord sollu => SolluMap sollu stroke -> ToStrokes (Stroke sollu) stroke Source #
Convert Sollus to strokes. The input Sollus have an extra Stroke wrapper.
The Stroke is extraneous and is ignored, it's just for uniformity with
realizeStroke
, since KorvaiSections
no longer has a separate
case for Sollu which allowed it to omit the Realize.Stroke.
text util
textLength :: Text -> Int Source #
DEBUG
newtype SolluMap sollu stroke Source #
Sollus and Strokes should be the same length. This is enforced in the
constructor solluMap
. Nothing is a rest, which means a sollu can map
to silence, which actually happens in practice.
SolluMap (Map (SolluMapKey sollu) [Maybe.Maybe (Stroke stroke)]) |
Instances
Ord sollu => Monoid (SolluMap sollu stroke) Source # | |
Ord sollu => Semigroup (SolluMap sollu stroke) Source # | |
(Show sollu, Show stroke) => Show (SolluMap sollu stroke) Source # | |
(Eq sollu, Eq stroke) => Eq (SolluMap sollu stroke) Source # | |
(Pretty.Pretty sollu, Pretty.Pretty stroke) => Pretty.Pretty (SolluMap sollu stroke) Source # | |
solluMap :: (Pretty.Pretty stroke, Pretty.Pretty sollu, Ord sollu) => [(S.Sequence g (Solkattu.Note sollu), [SNote stroke])] -> Either Error (SolluMap sollu stroke, [(SolluMapKey sollu, [Maybe.Maybe (Stroke stroke)])]) Source #
Verify and costruct a SolluMap from a list of pairs. Later pairs win over earlier ones.