-- Copyright 2017 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

{-# LANGUAGE RecordWildCards #-}
-- | Global imports for solkattu score modules.
module Solkattu.Dsl.Solkattu (
    module Solkattu.Dsl.Solkattu
    , module Solkattu.Dsl.Generic
    , module Solkattu.Dsl.Interactive
) where
import           Prelude hiding ((.), (^))
import qualified Data.List as List
import qualified Data.Map as Map
import qualified Data.String as String
import qualified Data.Text as Text
import qualified Data.Text.IO as Text.IO

import qualified Util.CallStack as CallStack
import qualified Solkattu.Dsl.Interactive as Interactive
import           Solkattu.Dsl.Interactive (diff, diffw)
import qualified Solkattu.Dsl.MridangamNotation as MridangamNotation
import qualified Solkattu.Format.Terminal as Terminal
import qualified Solkattu.Instrument.KendangPasang as KendangPasang
import qualified Solkattu.Instrument.KendangTunggal as KendangTunggal
import qualified Solkattu.Instrument.Mridangam as Mridangam
import qualified Solkattu.Instrument.Reyong as Reyong
import qualified Solkattu.Instrument.Sargam as Sargam
import qualified Solkattu.Korvai as Korvai
import qualified Solkattu.Realize as Realize
import qualified Solkattu.S as S
import qualified Solkattu.Solkattu as Solkattu
import qualified Solkattu.Tala as Tala

import           Global
import           Solkattu.Dsl.Generic


type Sequence = SequenceT Solkattu.Sollu
type SequenceR stroke = SequenceT (Realize.Stroke stroke)
type SequenceM = SequenceR Mridangam.Stroke

type Section = Korvai.Section Sequence

instance String.IsString Sequence where
    -- Even with InstanceSigs, this doesn't actually work to add a call stack.
    -- fromString :: CallStack.Stack => String -> Sequence
    fromString :: String -> Sequence
fromString String
s = Stack => Text -> Sequence
Text -> Sequence
strS (String -> Text
txt String
s)

instance String.IsString SequenceM where
    fromString :: String -> SequenceM
fromString = Stack => String -> SequenceM
String -> SequenceM
strM

-- * sollus

_sollu :: Solkattu.Sollu -> Sequence
_sollu :: Sollu -> Sequence
_sollu Sollu
s = Note Group (Note Sollu) -> Sequence
forall g a. Note g a -> Sequence g a
S.singleton (Note Group (Note Sollu) -> Sequence)
-> Note Group (Note Sollu) -> Sequence
forall a b. (a -> b) -> a -> b
$ Note Sollu -> Note Group (Note Sollu)
forall g a. a -> Note g a
S.Note (NoteT Sollu -> Note Sollu
forall sollu. NoteT sollu -> Note sollu
Solkattu.Note (Sollu -> NoteT Sollu
forall sollu. sollu -> NoteT sollu
Solkattu.note Sollu
s))

cham :: Sequence
cham = Sollu -> Sequence
_sollu Sollu
Solkattu.Cham
dheem :: Sequence
dheem = Sollu -> Sequence
_sollu Sollu
Solkattu.Dheem
dhom :: Sequence
dhom = Sollu -> Sequence
_sollu Sollu
Solkattu.Dhom
di :: Sequence
di = Sollu -> Sequence
_sollu Sollu
Solkattu.Di
din :: Sequence
din = Sollu -> Sequence
_sollu Sollu
Solkattu.Din
dim :: Sequence
dim = Sollu -> Sequence
_sollu Sollu
Solkattu.Dim
dit :: Sequence
dit = Sollu -> Sequence
_sollu Sollu
Solkattu.Dit
du :: Sequence
du = Sollu -> Sequence
_sollu Sollu
Solkattu.Du
ga :: Sequence
ga = Sollu -> Sequence
_sollu Sollu
Solkattu.Ga
gin :: Sequence
gin = Sollu -> Sequence
_sollu Sollu
Solkattu.Gin
gu :: Sequence
gu = Sollu -> Sequence
_sollu Sollu
Solkattu.Gu
jo :: Sequence
jo = Sollu -> Sequence
_sollu Sollu
Solkattu.Jo
ka :: Sequence
ka = Sollu -> Sequence
_sollu Sollu
Solkattu.Ka
ki :: Sequence
ki = Sollu -> Sequence
_sollu Sollu
Solkattu.Ki
ku :: Sequence
ku = Sollu -> Sequence
_sollu Sollu
Solkattu.Ku
kum :: Sequence
kum = Sollu -> Sequence
_sollu Sollu
Solkattu.Kum
mi :: Sequence
mi = Sollu -> Sequence
_sollu Sollu
Solkattu.Mi
na :: Sequence
na = Sollu -> Sequence
_sollu Sollu
Solkattu.Na
nam :: Sequence
nam = Sollu -> Sequence
_sollu Sollu
Solkattu.Nam
nang :: Sequence
nang = Sollu -> Sequence
_sollu Sollu
Solkattu.Nang
nu :: Sequence
nu = Sollu -> Sequence
_sollu Sollu
Solkattu.Nu
ri :: Sequence
ri = Sollu -> Sequence
_sollu Sollu
Solkattu.Ri
ta :: Sequence
ta = Sollu -> Sequence
_sollu Sollu
Solkattu.Ta
tam :: Sequence
tam = Sollu -> Sequence
_sollu Sollu
Solkattu.Tam
tat :: Sequence
tat = Sollu -> Sequence
_sollu Sollu
Solkattu.Tat
tha :: Sequence
tha = Sollu -> Sequence
_sollu Sollu
Solkattu.Tha
thom :: Sequence
thom = Sollu -> Sequence
_sollu Sollu
Solkattu.Thom
ti :: Sequence
ti = Sollu -> Sequence
_sollu Sollu
Solkattu.Ti

tang :: Sequence
tang = Sollu -> Sequence
_sollu Sollu
Solkattu.Tang
tong :: Sequence
tong = Sollu -> Sequence
_sollu Sollu
Solkattu.Tong
lang :: Sequence
lang = Sollu -> Sequence
_sollu Sollu
Solkattu.Lang

-- | Parse a string to sollus.  Look for syllables inside words.
strS :: CallStack.Stack => Text -> Sequence
strS :: Stack => Text -> Sequence
strS Text
str = [Sequence] -> Sequence
forall a. Monoid a => [a] -> a
mconcat ([Sequence] -> Sequence) -> [Sequence] -> Sequence
forall a b. (a -> b) -> a -> b
$ (Maybe Sollu -> Sequence) -> [Maybe Sollu] -> [Sequence]
forall a b. (a -> b) -> [a] -> [b]
map (Sequence -> (Sollu -> Sequence) -> Maybe Sollu -> Sequence
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Sequence
forall a. Rest a => a
__ Sollu -> Sequence
_sollu) ([Maybe Sollu] -> [Sequence]) -> [Maybe Sollu] -> [Sequence]
forall a b. (a -> b) -> a -> b
$ Either Text [Maybe Sollu] -> [Maybe Sollu]
forall a. Stack => Either Text a -> a
check (Either Text [Maybe Sollu] -> [Maybe Sollu])
-> Either Text [Maybe Sollu] -> [Maybe Sollu]
forall a b. (a -> b) -> a -> b
$ Text -> Either Text [Maybe Sollu]
Solkattu.parseSollus Text
str

-- * fragments

-- TODO these should be namedT Solkattu.GPattern "p#", but that makes
-- 'spread' not work.
tdgnt, td_gnt, t_d_gnt :: Sequence
tdgnt :: Sequence
tdgnt = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
dinSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ginSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
naSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
thom
td_gnt :: Sequence
td_gnt = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
dinSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ginSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
naSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
thom
t_d_gnt :: Sequence
t_d_gnt = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
dinSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ginSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
naSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
thom

takadinna, takita, kita, taka, tiku, diku, tari, gugu, dugu :: Sequence
takadinna :: Sequence
takadinna = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
kaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
dinSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
na
takita :: Sequence
takita = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
kiSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ta
kita :: Sequence
kita = Sequence
kiSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ta
taka :: Sequence
taka = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ka
naka :: Sequence
naka = Sequence
naSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ka
tiku :: Sequence
tiku = Sequence
tiSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ku
diku :: Sequence
diku = Sequence
diSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ku
tari :: Sequence
tari = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ri
gugu :: Sequence
gugu = Sequence
guSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
gu
dugu :: Sequence
dugu = Sequence
duSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
gu

jonu :: Sequence
jonu :: Sequence
jonu = Sequence
joSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
nu

kitataka, tarikita, tadikita :: Sequence
kitataka :: Sequence
kitataka = Sequence
kitaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
taka
tarikita :: Sequence
tarikita = Sequence
tariSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
kita
tadikita :: Sequence
tadikita = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
diSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
kiSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ta

talang, talanga :: Sequence
talang :: Sequence
talang = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
lang
talanga :: Sequence
talanga = Sequence
taSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
langa

dinga, dingu, tanga, langa :: Sequence
dinga :: Sequence
dinga = Sequence
dinSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ga
dingu :: Sequence
dingu = Sequence
dinSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
gu
tanga :: Sequence
tanga = Sequence
tangSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ga
langa :: Sequence
langa = Sequence
langSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
forall a. Rest a => a
__Sequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
ga

-- ** fast variants

kt, tk, tkt, tkdn, trkt, kttk :: Sequence
kt :: Sequence
kt = Sequence -> Sequence
forall g sollu. Sequence g sollu -> Sequence g sollu
su Sequence
kita
tk :: Sequence
tk = Sequence -> Sequence
forall g sollu. Sequence g sollu -> Sequence g sollu
su Sequence
taka
tkt :: Sequence
tkt = Sequence -> Sequence
forall g sollu. Sequence g sollu -> Sequence g sollu
su Sequence
takita
tkdn :: Sequence
tkdn = Sequence -> Sequence
forall g sollu. Sequence g sollu -> Sequence g sollu
su Sequence
takadinna
trkt :: Sequence
trkt = Sequence -> Sequence
forall g sollu. Sequence g sollu -> Sequence g sollu
su Sequence
tarikita
kttk :: Sequence
kttk = Sequence -> Sequence
forall g sollu. Sequence g sollu -> Sequence g sollu
su Sequence
kitataka

-- ** standard fragments

-- It's awkward that these use mridangam fingerings instead of solkattu, but
-- the solkattu are otherwise ambiguous, and too long anyway.  I originally
-- used solkattu without vowels, but later I wanted to use the same names for
-- fast variants.

kp, kpnp :: Sequence
kp :: Sequence
kp = GroupType -> Text -> Sequence -> Sequence
forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GFiller Text
"2t" (Tag
Solkattu.Standard Tag -> Sequence -> Sequence
forall sollu. Tag -> SequenceT sollu -> SequenceT sollu
^ Sequence
taka)
kpnp :: Sequence
kpnp = GroupType -> Text -> Sequence -> Sequence
forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GFiller Text
"4t" (Tag
Solkattu.Standard Tag -> Sequence -> Sequence
forall sollu. Tag -> SequenceT sollu -> SequenceT sollu
^ (Sequence
takaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
tiku))

-- These are more problematic because different realizations are common, e.g.
-- oktp, pktp.
oknp, ktktoknp :: Sequence
oknp :: Sequence
oknp = GroupType -> Text -> Sequence -> Sequence
forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GFiller Text
"4t" (Sequence -> Sequence) -> Sequence -> Sequence
forall a b. (a -> b) -> a -> b
$ Tag
Solkattu.Standard Tag -> Sequence -> Sequence
forall sollu. Tag -> SequenceT sollu -> SequenceT sollu
^ Sequence
tarikita
ktktoknp :: Sequence
ktktoknp = GroupType -> Text -> Sequence -> Sequence
forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GFiller Text
"8t" (Sequence -> Sequence) -> Sequence -> Sequence
forall a b. (a -> b) -> a -> b
$
    Tag
Solkattu.Standard Tag -> Sequence -> Sequence
forall sollu. Tag -> SequenceT sollu -> SequenceT sollu
^ (Sequence
tarikitaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
takaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
taka)

nakatiku :: Sequence
nakatiku :: Sequence
nakatiku = GroupType -> Text -> Sequence -> Sequence
forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GPattern Text
"8n" (Sequence -> Sequence) -> Sequence -> Sequence
forall a b. (a -> b) -> a -> b
$
    Tag
Solkattu.Standard Tag -> Sequence -> Sequence
forall sollu. Tag -> SequenceT sollu -> SequenceT sollu
^ (Sequence
nakaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
tikuSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
tariSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
kita)
    -- also diku.tari.kita.taka

takadugutarikita :: Sequence
takadugutarikita :: Sequence
takadugutarikita = GroupType -> Text -> Sequence -> Sequence
forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GPattern Text
"8t" (Sequence -> Sequence) -> Sequence -> Sequence
forall a b. (a -> b) -> a -> b
$
    Tag
Solkattu.Standard Tag -> Sequence -> Sequence
forall sollu. Tag -> SequenceT sollu -> SequenceT sollu
^ (Sequence
takaSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
duguSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
tariSequence -> Sequence -> Sequence
forall a. Monoid a => a -> a -> a
.Sequence
kita)

-- * instruments

Mridangam.Strokes {Sequence g (Note (Stroke Stroke))
od :: Sequence g (Note (Stroke Stroke))
_' :: Sequence g (Note (Stroke Stroke))
o' :: Sequence g (Note (Stroke Stroke))
o :: Sequence g (Note (Stroke Stroke))
p' :: Sequence g (Note (Stroke Stroke))
p :: Sequence g (Note (Stroke Stroke))
j :: Sequence g (Note (Stroke Stroke))
y :: Sequence g (Note (Stroke Stroke))
i :: Sequence g (Note (Stroke Stroke))
v :: Sequence g (Note (Stroke Stroke))
u :: Sequence g (Note (Stroke Stroke))
d :: Sequence g (Note (Stroke Stroke))
n :: Sequence g (Note (Stroke Stroke))
l :: Sequence g (Note (Stroke Stroke))
t :: Sequence g (Note (Stroke Stroke))
k :: Sequence g (Note (Stroke Stroke))
od :: forall a. Strokes a -> a
_' :: forall a. Strokes a -> a
o' :: forall a. Strokes a -> a
o :: forall a. Strokes a -> a
p' :: forall a. Strokes a -> a
p :: forall a. Strokes a -> a
j :: forall a. Strokes a -> a
y :: forall a. Strokes a -> a
i :: forall a. Strokes a -> a
v :: forall a. Strokes a -> a
u :: forall a. Strokes a -> a
d :: forall a. Strokes a -> a
n :: forall a. Strokes a -> a
l :: forall a. Strokes a -> a
t :: forall a. Strokes a -> a
k :: forall a. Strokes a -> a
..} = Strokes (Sequence g (Note (Stroke Stroke)))
forall g. Strokes (Sequence g (Note (Stroke Stroke)))
Mridangam.notes

-- | Merge a sequence of left hand strokes with one of right hand strokes.
-- Both sequences must have the same length and structure.
(&) :: CallStack.Stack => SequenceM -> SequenceM -> SequenceM
SequenceM
a & :: Stack => SequenceM -> SequenceM -> SequenceM
& SequenceM
b = [Note Group (Note (Stroke Stroke))] -> SequenceM
forall g a. [Note g a] -> Sequence g a
S.fromList ([Note Group (Note (Stroke Stroke))] -> SequenceM)
-> [Note Group (Note (Stroke Stroke))] -> SequenceM
forall a b. (a -> b) -> a -> b
$ Stack =>
[Note Group (Note (Stroke Stroke))]
-> [Note Group (Note (Stroke Stroke))]
-> [Note Group (Note (Stroke Stroke))]
[Note Group (Note (Stroke Stroke))]
-> [Note Group (Note (Stroke Stroke))]
-> [Note Group (Note (Stroke Stroke))]
MridangamNotation.merge (SequenceM -> [Note Group (Note (Stroke Stroke))]
forall g a. Sequence g a -> [Note g a]
S.toList SequenceM
a) (SequenceM -> [Note Group (Note (Stroke Stroke))]
forall g a. Sequence g a -> [Note g a]
S.toList SequenceM
b)

on :: SequenceM
on :: SequenceM
on = SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oStack => SequenceM -> SequenceM -> SequenceM
SequenceM -> SequenceM -> SequenceM
&SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
n

-- | Parse a string to mridangam strokes.
strM :: CallStack.Stack => String -> SequenceM
strM :: Stack => String -> SequenceM
strM String
str = (Maybe Stroke -> SequenceM) -> [Maybe Stroke] -> SequenceM
forall b a. Monoid b => (a -> b) -> [a] -> b
mconcatMap Maybe Stroke -> SequenceM
forall {g} {stroke}.
Rest (Sequence g (Note (Stroke stroke))) =>
Maybe stroke -> Sequence g (Note (Stroke stroke))
toSeq ([Maybe Stroke] -> SequenceM) -> [Maybe Stroke] -> SequenceM
forall a b. (a -> b) -> a -> b
$ Either Text [Maybe Stroke] -> [Maybe Stroke]
forall a. Stack => Either Text a -> a
Solkattu.check (Either Text [Maybe Stroke] -> [Maybe Stroke])
-> Either Text [Maybe Stroke] -> [Maybe Stroke]
forall a b. (a -> b) -> a -> b
$ String -> Either Text [Maybe Stroke]
Mridangam.fromString String
str
    where
    toSeq :: Maybe stroke -> Sequence g (Note (Stroke stroke))
toSeq Maybe stroke
Nothing = Sequence g (Note (Stroke stroke))
forall a. Rest a => a
__
    toSeq (Just stroke
stroke) = stroke -> Sequence g (Note (Stroke stroke))
forall stroke g. stroke -> Sequence g (Note (Stroke stroke))
Realize.strokeToSequence stroke
stroke

type StrokeMap stroke =
    [ ( Sequence
      , S.Sequence Solkattu.Group (Solkattu.Note (Realize.Stroke stroke))
      )
    ]

makeMridangam :: StrokeMap Mridangam.Stroke -> Korvai.StrokeMaps
makeMridangam :: StrokeMap Stroke -> StrokeMaps
makeMridangam StrokeMap Stroke
strokes = StrokeMap Stroke -> StrokeMaps
makeMridangam0 (StrokeMap Stroke
_mridangamStrokes StrokeMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall a. [a] -> [a] -> [a]
++ StrokeMap Stroke
strokes)

-- | Make a mridangam StrokeMap, but without the default '_mridangamStrokes'.
makeMridangam0 :: StrokeMap Mridangam.Stroke -> Korvai.StrokeMaps
makeMridangam0 :: StrokeMap Stroke -> StrokeMaps
makeMridangam0 StrokeMap Stroke
strokes = StrokeMaps
forall a. Monoid a => a
mempty
    { smapMridangam :: StrokeMap Stroke
Korvai.smapMridangam = PatternMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall stroke g.
Pretty stroke =>
PatternMap stroke
-> [(Sequence g (Note Sollu), Sequence g (Note (Stroke stroke)))]
-> Either Text (StrokeMap stroke)
Realize.strokeMap PatternMap Stroke
Mridangam.defaultPatterns StrokeMap Stroke
strokes
    }

-- | Show shadowed strokes in the stroke map.
lintM :: Korvai.Korvai -> IO ()
lintM :: Korvai -> IO ()
lintM = Instrument Stroke -> StrokeMap Stroke -> Korvai -> IO ()
forall stroke x.
Pretty stroke =>
Instrument stroke -> [(Sequence, x)] -> Korvai -> IO ()
_printLint Instrument Stroke
Korvai.IMridangam StrokeMap Stroke
_mridangamStrokes

makeKendang1 :: StrokeMap KendangTunggal.Stroke -> Korvai.StrokeMaps
makeKendang1 :: StrokeMap Stroke -> StrokeMaps
makeKendang1 StrokeMap Stroke
strokes = StrokeMaps
forall a. Monoid a => a
mempty
    { smapKendangTunggal :: StrokeMap Stroke
Korvai.smapKendangTunggal =
        PatternMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall stroke g.
Pretty stroke =>
PatternMap stroke
-> [(Sequence g (Note Sollu), Sequence g (Note (Stroke stroke)))]
-> Either Text (StrokeMap stroke)
Realize.strokeMap PatternMap Stroke
KendangTunggal.defaultPatterns
            (StrokeMap Stroke
_kendangStrokes1 StrokeMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall a. [a] -> [a] -> [a]
++ StrokeMap Stroke
strokes)
    }

lintK1 :: Korvai -> IO ()
lintK1 :: Korvai -> IO ()
lintK1 = Instrument Stroke -> StrokeMap Stroke -> Korvai -> IO ()
forall stroke x.
Pretty stroke =>
Instrument stroke -> [(Sequence, x)] -> Korvai -> IO ()
_printLint Instrument Stroke
Korvai.IKendangTunggal StrokeMap Stroke
_kendangStrokes1

makeKendang2 :: StrokeMap KendangPasang.Stroke -> Korvai.StrokeMaps
makeKendang2 :: StrokeMap Stroke -> StrokeMaps
makeKendang2 StrokeMap Stroke
strokes = StrokeMaps
forall a. Monoid a => a
mempty
    { smapKendangPasang :: StrokeMap Stroke
Korvai.smapKendangPasang =
        PatternMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall stroke g.
Pretty stroke =>
PatternMap stroke
-> [(Sequence g (Note Sollu), Sequence g (Note (Stroke stroke)))]
-> Either Text (StrokeMap stroke)
Realize.strokeMap PatternMap Stroke
KendangPasang.defaultPatterns
            (StrokeMap Stroke
_kendangStrokes2 StrokeMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall a. [a] -> [a] -> [a]
++ StrokeMap Stroke
strokes)
    }

lintK2 :: Korvai -> IO ()
lintK2 :: Korvai -> IO ()
lintK2 = Instrument Stroke -> StrokeMap Stroke -> Korvai -> IO ()
forall stroke x.
Pretty stroke =>
Instrument stroke -> [(Sequence, x)] -> Korvai -> IO ()
_printLint Instrument Stroke
Korvai.IKendangTunggal StrokeMap Stroke
_kendangStrokes2

makeReyong :: StrokeMap Reyong.Stroke -> Korvai.StrokeMaps
makeReyong :: StrokeMap Stroke -> StrokeMaps
makeReyong StrokeMap Stroke
strokes = StrokeMaps
forall a. Monoid a => a
mempty
    { smapReyong :: StrokeMap Stroke
Korvai.smapReyong = PatternMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall stroke g.
Pretty stroke =>
PatternMap stroke
-> [(Sequence g (Note Sollu), Sequence g (Note (Stroke stroke)))]
-> Either Text (StrokeMap stroke)
Realize.strokeMap
        PatternMap Stroke
Reyong.rhythmicPatterns (StrokeMap Stroke
_reyongStrokes StrokeMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall a. [a] -> [a] -> [a]
++ StrokeMap Stroke
strokes)
    }

lintR :: Korvai -> IO ()
lintR :: Korvai -> IO ()
lintR = Instrument Stroke -> StrokeMap Stroke -> Korvai -> IO ()
forall stroke x.
Pretty stroke =>
Instrument stroke -> [(Sequence, x)] -> Korvai -> IO ()
_printLint Instrument Stroke
Korvai.IReyong StrokeMap Stroke
_reyongStrokes

makeSargam :: [(S.Matra, SequenceR Sargam.Stroke)]
    -> StrokeMap Sargam.Stroke -> Korvai.StrokeMaps
makeSargam :: [(Matra, SequenceR Stroke)] -> StrokeMap Stroke -> StrokeMaps
makeSargam [(Matra, SequenceR Stroke)]
patterns StrokeMap Stroke
strokes = StrokeMaps
forall a. Monoid a => a
mempty { smapSargam :: StrokeMap Stroke
Korvai.smapSargam = StrokeMap Stroke
convert }
    where
    convert :: StrokeMap Stroke
convert = do
        [(Pattern, [Note () (Note Stroke)])]
patterns <- ((Pattern, SequenceR Stroke)
 -> Either Text (Pattern, [Note () (Note Stroke)]))
-> [(Pattern, SequenceR Stroke)]
-> Either Text [(Pattern, [Note () (Note Stroke)])]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((SequenceR Stroke -> Either Text [Note () (Note Stroke)])
-> (Pattern, SequenceR Stroke)
-> Either Text (Pattern, [Note () (Note Stroke)])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse SequenceR Stroke -> Either Text [Note () (Note Stroke)]
forall g stroke.
Sequence g (Note (Stroke stroke))
-> Either Text [Note () (Note stroke)]
Realize.solkattuToRealize) ([(Pattern, SequenceR Stroke)]
 -> Either Text [(Pattern, [Note () (Note Stroke)])])
-> [(Pattern, SequenceR Stroke)]
-> Either Text [(Pattern, [Note () (Note Stroke)])]
forall a b. (a -> b) -> a -> b
$
            ((Matra, SequenceR Stroke) -> (Pattern, SequenceR Stroke))
-> [(Matra, SequenceR Stroke)] -> [(Pattern, SequenceR Stroke)]
forall a b. (a -> b) -> [a] -> [b]
map ((Matra -> Pattern)
-> (Matra, SequenceR Stroke) -> (Pattern, SequenceR Stroke)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first Matra -> Pattern
Solkattu.pattern) [(Matra, SequenceR Stroke)]
patterns
        PatternMap Stroke
pmap <- [(Pattern, Sequence () (Note Stroke))]
-> Either Text (PatternMap Stroke)
forall stroke.
[(Pattern, Sequence () (Note stroke))]
-> Either Text (PatternMap stroke)
Realize.patternMap ([(Pattern, Sequence () (Note Stroke))]
 -> Either Text (PatternMap Stroke))
-> [(Pattern, Sequence () (Note Stroke))]
-> Either Text (PatternMap Stroke)
forall a b. (a -> b) -> a -> b
$ ((Pattern, [Note () (Note Stroke)])
 -> (Pattern, Sequence () (Note Stroke)))
-> [(Pattern, [Note () (Note Stroke)])]
-> [(Pattern, Sequence () (Note Stroke))]
forall a b. (a -> b) -> [a] -> [b]
map (([Note () (Note Stroke)] -> Sequence () (Note Stroke))
-> (Pattern, [Note () (Note Stroke)])
-> (Pattern, Sequence () (Note Stroke))
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second [Note () (Note Stroke)] -> Sequence () (Note Stroke)
forall g a. [Note g a] -> Sequence g a
S.fromList) [(Pattern, [Note () (Note Stroke)])]
patterns
        PatternMap Stroke -> StrokeMap Stroke -> StrokeMap Stroke
forall stroke g.
Pretty stroke =>
PatternMap stroke
-> [(Sequence g (Note Sollu), Sequence g (Note (Stroke stroke)))]
-> Either Text (StrokeMap stroke)
Realize.strokeMap PatternMap Stroke
pmap StrokeMap Stroke
strokes

lintS :: Korvai -> IO ()
lintS :: Korvai -> IO ()
lintS = Instrument Stroke -> [(Sequence, Any)] -> Korvai -> IO ()
forall stroke x.
Pretty stroke =>
Instrument stroke -> [(Sequence, x)] -> Korvai -> IO ()
_printLint Instrument Stroke
Korvai.ISargam []

_defaultStrokes :: Korvai.Instrument stroke -> [Sequence]
_defaultStrokes :: forall stroke. Instrument stroke -> [Sequence]
_defaultStrokes Instrument stroke
inst = [Sequence] -> Text -> Map Text [Sequence] -> [Sequence]
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault [] (Instrument stroke -> Text
forall stroke. Instrument stroke -> Text
Korvai.instrumentName Instrument stroke
inst)
    Map Text [Sequence]
_instrumentDefaultStrokes

lintAll :: Korvai -> IO ()
lintAll :: Korvai -> IO ()
lintAll = Text -> IO ()
Text.IO.putStr (Text -> IO ()) -> (Korvai -> Text) -> Korvai -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
 Korvai -> Text
allLints

allLints :: Korvai -> Text
allLints :: Korvai -> Text
allLints Korvai
korvai =
    [Text] -> Text
Text.unlines ([Text] -> Text) -> [Text] -> Text
forall a b. (a -> b) -> a -> b
$ Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
List.intersperse Text
"" ([Text] -> [Text]) -> [Text] -> [Text]
forall a b. (a -> b) -> a -> b
$
        (GInstrument -> Maybe Text) -> [GInstrument] -> [Text]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe GInstrument -> Maybe Text
lintsOf (Korvai -> [GInstrument]
Korvai.korvaiInstruments Korvai
korvai)
    where
    lintsOf :: GInstrument -> Maybe Text
lintsOf (Korvai.GInstrument Instrument stroke
inst)
        | Text -> Bool
Text.null Text
warn = Maybe Text
forall a. Maybe a
Nothing
        | Bool
otherwise = Text -> Maybe Text
forall a. a -> Maybe a
Just (Text -> Maybe Text) -> Text -> Maybe Text
forall a b. (a -> b) -> a -> b
$ Text
"    " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
name Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
":\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
warn
        where
        warn :: Text
warn = Instrument stroke -> [Sequence] -> Korvai -> Text
forall stroke.
Pretty stroke =>
Instrument stroke -> [Sequence] -> Korvai -> Text
Korvai.lint Instrument stroke
inst (Text -> [Sequence]
get Text
name) Korvai
korvai
        name :: Text
name = Instrument stroke -> Text
forall stroke. Instrument stroke -> Text
Korvai.instrumentName Instrument stroke
inst
    get :: Text -> [Sequence]
get Text
name = [Sequence] -> Text -> Map Text [Sequence] -> [Sequence]
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault [] Text
name Map Text [Sequence]
_instrumentDefaultStrokes

-- | 'makeMridangam' gives this to all mridangam stroke maps.
_mridangamStrokes :: [(Sequence, SequenceM)]
_mridangamStrokes :: StrokeMap Stroke
_mridangamStrokes =
    [ (Sequence
thom, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
dhom, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
tang, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
lang, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
cham, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
talang, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
takadinna, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
k)
    , (Sequence
tdgnt, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
nSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
kp, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
p)
    , (Sequence
kpnp, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
nSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
p)
    , (Sequence
oknp, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
nSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
p) -- fast version: pktp
    , (Sequence
ktktoknp, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
nSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
p)
    , (Sequence
nakatiku, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
nSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
uSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
k)
        -- alternate: t.p.u.p.k.t.p.k
        -- alternate: t.p.u.o.k.t.p.k
    , (Sequence
takadugutarikita, SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceM -> SequenceM -> SequenceM
forall a. Monoid a => a -> a -> a
.SequenceM
forall {g}. Sequence g (Note (Stroke Stroke))
k)
    ]
    where Mridangam.Strokes {Sequence g (Note (Stroke Stroke))
od :: Sequence g (Note (Stroke Stroke))
_' :: Sequence g (Note (Stroke Stroke))
o' :: Sequence g (Note (Stroke Stroke))
p' :: Sequence g (Note (Stroke Stroke))
j :: Sequence g (Note (Stroke Stroke))
y :: Sequence g (Note (Stroke Stroke))
i :: Sequence g (Note (Stroke Stroke))
v :: Sequence g (Note (Stroke Stroke))
d :: Sequence g (Note (Stroke Stroke))
l :: Sequence g (Note (Stroke Stroke))
n :: Sequence g (Note (Stroke Stroke))
t :: Sequence g (Note (Stroke Stroke))
k :: Sequence g (Note (Stroke Stroke))
p :: Sequence g (Note (Stroke Stroke))
u :: Sequence g (Note (Stroke Stroke))
o :: Sequence g (Note (Stroke Stroke))
od :: forall a. Strokes a -> a
_' :: forall a. Strokes a -> a
o' :: forall a. Strokes a -> a
o :: forall a. Strokes a -> a
p' :: forall a. Strokes a -> a
p :: forall a. Strokes a -> a
j :: forall a. Strokes a -> a
y :: forall a. Strokes a -> a
i :: forall a. Strokes a -> a
v :: forall a. Strokes a -> a
u :: forall a. Strokes a -> a
d :: forall a. Strokes a -> a
n :: forall a. Strokes a -> a
l :: forall a. Strokes a -> a
t :: forall a. Strokes a -> a
k :: forall a. Strokes a -> a
..} = Strokes (Sequence g (Note (Stroke Stroke)))
forall g. Strokes (Sequence g (Note (Stroke Stroke)))
Mridangam.notes

_kendangStrokes1 :: [(Sequence, SequenceR KendangTunggal.Stroke)]
_kendangStrokes1 :: StrokeMap Stroke
_kendangStrokes1 =
    [ (Sequence
thom, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
a)
    , (Sequence
tang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
lang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
cham, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
talang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
takadinna, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
p)
    , (Sequence
tdgnt, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
a)
    , (Sequence
kp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
k)
    , (Sequence
kpnp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
k)
    , (Sequence
oknp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
ktktoknp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
nakatiku, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
KendangTunggal.nakatiku)
    , (Sequence
takadugutarikita, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
t)
    ]
    where KendangTunggal.Strokes {Sequence g (Note (Stroke Stroke))
a :: forall a. Strokes a -> a
o :: forall a. Strokes a -> a
k :: forall a. Strokes a -> a
å :: forall a. Strokes a -> a
u :: forall a. Strokes a -> a
t :: forall a. Strokes a -> a
p :: forall a. Strokes a -> a
pk :: forall a. Strokes a -> a
å :: Sequence g (Note (Stroke Stroke))
pk :: Sequence g (Note (Stroke Stroke))
t :: Sequence g (Note (Stroke Stroke))
k :: Sequence g (Note (Stroke Stroke))
p :: Sequence g (Note (Stroke Stroke))
o :: Sequence g (Note (Stroke Stroke))
u :: Sequence g (Note (Stroke Stroke))
a :: Sequence g (Note (Stroke Stroke))
..} = Strokes (Sequence g (Note (Stroke Stroke)))
forall g. Strokes (Sequence g (Note (Stroke Stroke)))
KendangTunggal.notes

_kendangStrokes2 :: [(Sequence, SequenceR KendangPasang.Stroke)]
_kendangStrokes2 :: StrokeMap Stroke
_kendangStrokes2 =
    [ (Sequence
thom, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
a)
    , (Sequence
tang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
y)
    , (Sequence
lang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
y)
    , (Sequence
cham, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
y)
    , (Sequence
talang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
u)
    , (Sequence
takadinna, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
k)
    , (Sequence
tdgnt, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
lSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
a)
    , (Sequence
kp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
p)
    , (Sequence
kpnp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
l)
    , (Sequence
oknp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
lSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
a)
    , (Sequence
ktktoknp, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
oSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
lSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
a)
    , (Sequence
nakatiku, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
KendangPasang.nakatiku)
    , (Sequence
takadugutarikita, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
pSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
aSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
tSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
lSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
kSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
p)
    ]
    where KendangPasang.Strokes {Sequence g (Note (Stroke Stroke))
o :: forall a. Strokes a -> a
a :: forall a. Strokes a -> a
yy :: forall a. Strokes a -> a
y :: forall a. Strokes a -> a
u :: forall a. Strokes a -> a
l :: forall a. Strokes a -> a
t :: forall a. Strokes a -> a
p :: forall a. Strokes a -> a
k :: forall a. Strokes a -> a
pk :: forall a. Strokes a -> a
yy :: Sequence g (Note (Stroke Stroke))
pk :: Sequence g (Note (Stroke Stroke))
t :: Sequence g (Note (Stroke Stroke))
l :: Sequence g (Note (Stroke Stroke))
k :: Sequence g (Note (Stroke Stroke))
o :: Sequence g (Note (Stroke Stroke))
p :: Sequence g (Note (Stroke Stroke))
u :: Sequence g (Note (Stroke Stroke))
y :: Sequence g (Note (Stroke Stroke))
a :: Sequence g (Note (Stroke Stroke))
..} = Strokes (Sequence g (Note (Stroke Stroke)))
forall g. Strokes (Sequence g (Note (Stroke Stroke)))
KendangPasang.notes

_reyongStrokes :: [(Sequence, SequenceR Reyong.Stroke)]
_reyongStrokes :: StrokeMap Stroke
_reyongStrokes =
    [ (Sequence
thom, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
tang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
lang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
cham, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
talang, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
bSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
o)
    , (Sequence
nakatiku, SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
iSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
r3SequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
iSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
r2SequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
r3SequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
iSequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
r3SequenceR Stroke -> SequenceR Stroke -> SequenceR Stroke
forall a. Monoid a => a -> a -> a
.SequenceR Stroke
forall {g}. Sequence g (Note (Stroke Stroke))
r2)
        -- TODO melodic version, there could also be a rhythmic version
    ]
    where Reyong.Strokes {Sequence g (Note (Stroke Stroke))
x :: forall a. Strokes a -> a
k :: forall a. Strokes a -> a
o :: forall a. Strokes a -> a
b :: forall a. Strokes a -> a
i :: forall a. Strokes a -> a
r4 :: forall a. Strokes a -> a
r3 :: forall a. Strokes a -> a
r2 :: forall a. Strokes a -> a
r1 :: forall a. Strokes a -> a
x :: Sequence g (Note (Stroke Stroke))
k :: Sequence g (Note (Stroke Stroke))
r4 :: Sequence g (Note (Stroke Stroke))
r1 :: Sequence g (Note (Stroke Stroke))
r2 :: Sequence g (Note (Stroke Stroke))
r3 :: Sequence g (Note (Stroke Stroke))
i :: Sequence g (Note (Stroke Stroke))
b :: Sequence g (Note (Stroke Stroke))
o :: Sequence g (Note (Stroke Stroke))
..} = Strokes (Sequence g (Note (Stroke Stroke)))
forall g. Strokes (Sequence g (Note (Stroke Stroke)))
Reyong.notes

_printLint :: Pretty stroke => Korvai.Instrument stroke -> [(Sequence, x)]
    -> Korvai -> IO ()
_printLint :: forall stroke x.
Pretty stroke =>
Instrument stroke -> [(Sequence, x)] -> Korvai -> IO ()
_printLint Instrument stroke
inst [(Sequence, x)]
strokes Korvai
korvai =
    Text -> IO ()
Text.IO.putStr (Text -> IO ()) -> Text -> IO ()
forall a b. (a -> b) -> a -> b
$ Instrument stroke -> [Sequence] -> Korvai -> Text
forall stroke.
Pretty stroke =>
Instrument stroke -> [Sequence] -> Korvai -> Text
Korvai.lint Instrument stroke
inst (((Sequence, x) -> Sequence) -> [(Sequence, x)] -> [Sequence]
forall a b. (a -> b) -> [a] -> [b]
map (Sequence, x) -> Sequence
forall a b. (a, b) -> a
fst [(Sequence, x)]
strokes) Korvai
korvai

_instrumentDefaultStrokes :: Map Text [Sequence]
_instrumentDefaultStrokes :: Map Text [Sequence]
_instrumentDefaultStrokes = [(Text, [Sequence])] -> Map Text [Sequence]
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
    [ Instrument Stroke -> StrokeMap Stroke -> (Text, [Sequence])
forall stroke x.
Instrument stroke -> [(Sequence, x)] -> (Text, [Sequence])
pair Instrument Stroke
Korvai.IMridangam StrokeMap Stroke
_mridangamStrokes
    , Instrument Stroke -> StrokeMap Stroke -> (Text, [Sequence])
forall stroke x.
Instrument stroke -> [(Sequence, x)] -> (Text, [Sequence])
pair Instrument Stroke
Korvai.IKendangTunggal StrokeMap Stroke
_kendangStrokes1
    , Instrument Stroke -> StrokeMap Stroke -> (Text, [Sequence])
forall stroke x.
Instrument stroke -> [(Sequence, x)] -> (Text, [Sequence])
pair Instrument Stroke
Korvai.IKendangPasang StrokeMap Stroke
_kendangStrokes2
    , Instrument Stroke -> StrokeMap Stroke -> (Text, [Sequence])
forall stroke x.
Instrument stroke -> [(Sequence, x)] -> (Text, [Sequence])
pair Instrument Stroke
Korvai.IReyong StrokeMap Stroke
_reyongStrokes
    ]
    where
    pair :: Korvai.Instrument stroke -> [(Sequence, x)] -> (Text, [Sequence])
    pair :: forall stroke x.
Instrument stroke -> [(Sequence, x)] -> (Text, [Sequence])
pair Instrument stroke
inst [(Sequence, x)]
strokes = (Instrument stroke -> Text
forall stroke. Instrument stroke -> Text
Korvai.instrumentName Instrument stroke
inst, ((Sequence, x) -> Sequence) -> [(Sequence, x)] -> [Sequence]
forall a b. (a -> b) -> [a] -> [b]
map (Sequence, x) -> Sequence
forall a b. (a, b) -> a
fst [(Sequence, x)]
strokes)

-- * realize

realize, realizep :: Korvai.Korvai -> IO ()
realize :: Korvai -> IO ()
realize = (Config -> Config) -> Korvai -> IO ()
realizeM Config -> Config
concrete
realizep :: Korvai -> IO ()
realizep = (Config -> Config) -> Korvai -> IO ()
realizeM Config -> Config
forall a. a -> a
id

-- The actual Config transformers are in Generic.

realizeM :: (Terminal.Config -> Terminal.Config) -> Korvai.Korvai -> IO ()
realizeM :: (Config -> Config) -> Korvai -> IO ()
realizeM = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IMridangam

realizek, realizekp :: Korvai.Korvai -> IO ()
realizek :: Korvai -> IO ()
realizek = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IKendangTunggal Config -> Config
concrete
realizekp :: Korvai -> IO ()
realizekp = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IKendangTunggal Config -> Config
forall a. a -> a
id

realizek2, realizek2p :: Korvai.Korvai -> IO ()
realizek2 :: Korvai -> IO ()
realizek2 = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IKendangPasang Config -> Config
concrete
realizek2p :: Korvai -> IO ()
realizek2p = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IKendangPasang Config -> Config
forall a. a -> a
id

realizeWadon :: Korvai.Korvai -> IO ()
realizeWadon :: Korvai -> IO ()
realizeWadon = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument
    -- (either Just (const Nothing) • KendangPasang.toTunggal)
    (Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just (Stroke Stroke -> Maybe (Stroke Stroke))
-> (Stroke Stroke -> Stroke Stroke)
-> Stroke Stroke
-> Maybe (Stroke Stroke)
forall b c a. (b -> c) -> (a -> b) -> a -> c
 Stroke Stroke -> Stroke Stroke
KendangPasang.toWadon)
    Instrument Stroke
Korvai.IKendangPasang Config -> Config
concrete

realizeLanang :: Korvai.Korvai -> IO ()
realizeLanang :: Korvai -> IO ()
realizeLanang = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument
    -- (either (const Nothing) Just • KendangPasang.toTunggal)
    (Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just (Stroke Stroke -> Maybe (Stroke Stroke))
-> (Stroke Stroke -> Stroke Stroke)
-> Stroke Stroke
-> Maybe (Stroke Stroke)
forall b c a. (b -> c) -> (a -> b) -> a -> c
 Stroke Stroke -> Stroke Stroke
KendangPasang.toLanang)
    Instrument Stroke
Korvai.IKendangPasang Config -> Config
concrete

realizeR :: (Terminal.Config -> Terminal.Config) -> Korvai.Korvai -> IO ()
realizeR :: (Config -> Config) -> Korvai -> IO ()
realizeR = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IReyong

realizeSargam :: (Terminal.Config -> Terminal.Config) -> Korvai.Korvai -> IO ()
realizeSargam :: (Config -> Config) -> Korvai -> IO ()
realizeSargam = (Stroke Stroke -> Maybe (Stroke Stroke))
-> Instrument Stroke -> (Config -> Config) -> Korvai -> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just Instrument Stroke
Korvai.ISargam

realizeKon :: Korvai -> IO ()
realizeKon :: Korvai -> IO ()
realizeKon = Config -> Korvai -> IO ()
Terminal.printKonnakol (Config -> Config
wide Config
Terminal.defaultConfig)

realizeKon_ :: Int -> Korvai -> IO ()
realizeKon_ :: Matra -> Korvai -> IO ()
realizeKon_ Matra
width = Config -> Korvai -> IO ()
Terminal.printKonnakol
    (Config -> Config
concrete (Config -> Config) -> Config -> Config
forall a b. (a -> b) -> a -> b
$ Config
Terminal.defaultConfig { _terminalWidth :: Matra
Terminal._terminalWidth = Matra
width })

-- | 'Korvai.realizeScore' specialized to mridangam, and disbale the usual lint
-- and diff.
realizeScoreM :: (Terminal.Config -> Terminal.Config) -> Score -> IO ()
realizeScoreM :: (Config -> Config) -> Score -> IO ()
realizeScoreM Config -> Config
configure = (Korvai -> IO ()) -> Score -> IO ()
Korvai.realizeScore Korvai -> IO ()
realize
    where
    realize :: Korvai -> IO ()
realize = Bool
-> Bool
-> Instrument Stroke
-> [Sequence]
-> Config
-> (Stroke Stroke -> Maybe (Stroke Stroke))
-> Korvai
-> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
Bool
-> Bool
-> Instrument stroke1
-> [Sequence]
-> Config
-> (Stroke stroke1 -> Maybe (Stroke stroke2))
-> Korvai
-> IO ()
Interactive.printInstrument Bool
False Bool
False Instrument Stroke
inst
        (Instrument Stroke -> [Sequence]
forall stroke. Instrument stroke -> [Sequence]
_defaultStrokes Instrument Stroke
inst) (Config -> Config
configure Config
Terminal.defaultConfig)
        Stroke Stroke -> Maybe (Stroke Stroke)
forall a. a -> Maybe a
Just
    inst :: Instrument Stroke
inst = Instrument Stroke
Korvai.IMridangam

-- | Like 'realize' but for Scores.
realizeScore :: Score -> IO ()
realizeScore :: Score -> IO ()
realizeScore = (Config -> Config) -> Score -> IO ()
realizeScoreM Config -> Config
concrete

_printInstrument
    :: (Solkattu.Notation stroke1, Solkattu.Notation stroke2, Ord stroke1)
    => (Realize.Stroke stroke1 -> Maybe (Realize.Stroke stroke2))
    -> Korvai.Instrument stroke1
    -> (Terminal.Config -> Terminal.Config)
    -> Korvai -> IO ()
_printInstrument :: forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
_printInstrument Stroke stroke1 -> Maybe (Stroke stroke2)
postproc Instrument stroke1
inst Config -> Config
setConfig =
    Bool
-> Bool
-> Instrument stroke1
-> [Sequence]
-> Config
-> (Stroke stroke1 -> Maybe (Stroke stroke2))
-> Korvai
-> IO ()
forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
Bool
-> Bool
-> Instrument stroke1
-> [Sequence]
-> Config
-> (Stroke stroke1 -> Maybe (Stroke stroke2))
-> Korvai
-> IO ()
Interactive.printInstrument Bool
True Bool
True Instrument stroke1
inst (Instrument stroke1 -> [Sequence]
forall stroke. Instrument stroke -> [Sequence]
_defaultStrokes Instrument stroke1
inst)
        (Config -> Config
setConfig Config
Terminal.defaultConfig) Stroke stroke1 -> Maybe (Stroke stroke2)
postproc

-- * korvai

korvai :: Tala.Tala -> Korvai.StrokeMaps -> [Section] -> Korvai
korvai :: Tala -> StrokeMaps -> [Section] -> Korvai
korvai = Tala -> StrokeMaps -> [Section] -> Korvai
Korvai.korvai

korvai1 :: Tala.Tala -> Korvai.StrokeMaps -> Section -> Korvai
korvai1 :: Tala -> StrokeMaps -> Section -> Korvai
korvai1 Tala
tala StrokeMaps
smaps Section
section = Tala -> StrokeMaps -> [Section] -> Korvai
korvai Tala
tala StrokeMaps
smaps [Section
section]

korvaiS :: Tala.Tala -> Korvai.StrokeMaps -> [Sequence] -> Korvai
korvaiS :: Tala -> StrokeMaps -> [Sequence] -> Korvai
korvaiS Tala
tala StrokeMaps
smaps = Tala -> StrokeMaps -> [Section] -> Korvai
korvai Tala
tala StrokeMaps
smaps ([Section] -> Korvai)
-> ([Sequence] -> [Section]) -> [Sequence] -> Korvai
forall b c a. (b -> c) -> (a -> b) -> a -> c
 [Sequence] -> [Section]
forall sollu. [SequenceT sollu] -> [Section (SequenceT sollu)]
Korvai.inferSections

korvaiS1 :: Tala.Tala -> Korvai.StrokeMaps -> Sequence -> Korvai
korvaiS1 :: Tala -> StrokeMaps -> Sequence -> Korvai
korvaiS1 Tala
tala StrokeMaps
smaps Sequence
seq = Tala -> StrokeMaps -> [Sequence] -> Korvai
korvaiS Tala
tala StrokeMaps
smaps [Sequence
seq]

-- TODO
-- vary :: Korvai -> Korvai
-- vary = Korvai.vary $ Solkattu.vary (Solkattu.variations [Solkattu.standard])