-- Copyright 2020 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 #-}
-- | Like "Solkattu.Dsl.Mridangam", but for kendang.
module Solkattu.Dsl.Kendang (
    module Solkattu.Dsl.Kendang
    , module Dsl.Solkattu
    , module Solkattu.Dsl.Generic
    , module Solkattu.Dsl.Interactive
) where
import           Prelude hiding ((.))

import           Solkattu.Dsl.Interactive (diff, diffw)
import qualified Solkattu.Dsl.Solkattu as Dsl.Solkattu
import           Solkattu.Dsl.Solkattu (realizeScoreM)
import qualified Solkattu.Format.Terminal as Terminal
import qualified Solkattu.Instrument.KendangTunggal as KendangTunggal
import qualified Solkattu.Korvai as Korvai
import qualified Solkattu.Realize as Realize
import qualified Solkattu.Solkattu as Solkattu
import qualified Solkattu.Tala as Tala

import           Global
import           Solkattu.Dsl.Generic


type Sequence = SequenceT Stroke
type Stroke = Realize.Stroke KendangTunggal.Stroke
type Section = Korvai.Section Sequence

korvai :: Tala.Tala -> [Section] -> Korvai.Korvai
korvai :: Tala -> [Section] -> Korvai
korvai Tala
tala = Tala -> PatternMap Stroke -> [Section] -> Korvai
Korvai.kendangTunggalKorvai Tala
tala PatternMap Stroke
KendangTunggal.defaultPatterns

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

-- | Infer Section types, as init is development, last is ending.
korvaiS :: Tala.Tala -> [Sequence] -> Korvai.Korvai
korvaiS :: Tala -> [Sequence] -> Korvai
korvaiS Tala
tala = Tala -> [Section] -> Korvai
korvai Tala
tala forall b c a. (b -> c) -> (a -> b) -> a -> c
 forall sollu. [SequenceT sollu] -> [Section (SequenceT sollu)]
Korvai.inferSections

korvaiS1 :: Tala.Tala -> Sequence -> Korvai.Korvai
korvaiS1 :: Tala -> Sequence -> Korvai
korvaiS1 Tala
tala Sequence
sequence = Tala -> [Sequence] -> Korvai
korvaiS Tala
tala [Sequence
sequence]

KendangTunggal.Strokes {Sequence g (Note (Stroke Stroke))
a :: Sequence g (Note (Stroke Stroke))
o :: Sequence g (Note (Stroke Stroke))
k :: Sequence g (Note (Stroke Stroke))
å :: Sequence g (Note (Stroke Stroke))
u :: Sequence g (Note (Stroke Stroke))
t :: Sequence g (Note (Stroke Stroke))
p :: Sequence g (Note (Stroke Stroke))
pk :: 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
..} = forall g. Strokes (Sequence g (Note (Stroke Stroke)))
KendangTunggal.notes

-- * interactive utilities

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

realizeK :: (Terminal.Config -> Terminal.Config) -> Korvai.Korvai -> IO ()
realizeK :: (Config -> Config) -> Korvai -> IO ()
realizeK = forall stroke1 stroke2.
(Notation stroke1, Notation stroke2, Ord stroke1) =>
(Stroke stroke1 -> Maybe (Stroke stroke2))
-> Instrument stroke1 -> (Config -> Config) -> Korvai -> IO ()
Dsl.Solkattu._printInstrument forall a. a -> Maybe a
Just Instrument Stroke
Korvai.IKendangTunggal

-- * strokes

nakatiku :: Sequence
nakatiku :: Sequence
nakatiku = forall sollu.
GroupType -> Text -> SequenceT sollu -> SequenceT sollu
namedT GroupType
Solkattu.GPattern Text
"8n" forall g. Sequence g (Note (Stroke Stroke))
KendangTunggal.nakatiku

pp :: Sequence
pp :: Sequence
pp = forall stroke.
SequenceT (Stroke stroke) -> SequenceT (Stroke stroke)
hv forall g. Sequence g (Note (Stroke Stroke))
p