module Solkattu.Bol (
Bol(..)
, parseBols
, Bols(..)
) where
import qualified Data.Text as Text
import qualified Util.Lists as Lists
import qualified Derive.Expr as Expr
import qualified Solkattu.Instrument.Tabla as Tabla
import qualified Solkattu.Realize as Realize
import qualified Solkattu.Solkattu as Solkattu
import Global
type BolT = Text
type Error = Text
data Bol =
Dha | Dhet |Dhom | Di | Din | Dhi | Dhin | Dhit | Ga | Gi | Ge | Ghen
| Ka | Kat | Kre | Ki | Na | Ne | Ra | Ri | Ran
| Ta | Tak | Taa | Te | Tet | Ti | Tu
| Kran
deriving (Bol -> Bol -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bol -> Bol -> Bool
$c/= :: Bol -> Bol -> Bool
== :: Bol -> Bol -> Bool
$c== :: Bol -> Bol -> Bool
Eq, Eq Bol
Bol -> Bol -> Bool
Bol -> Bol -> Ordering
Bol -> Bol -> Bol
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Bol -> Bol -> Bol
$cmin :: Bol -> Bol -> Bol
max :: Bol -> Bol -> Bol
$cmax :: Bol -> Bol -> Bol
>= :: Bol -> Bol -> Bool
$c>= :: Bol -> Bol -> Bool
> :: Bol -> Bol -> Bool
$c> :: Bol -> Bol -> Bool
<= :: Bol -> Bol -> Bool
$c<= :: Bol -> Bol -> Bool
< :: Bol -> Bol -> Bool
$c< :: Bol -> Bol -> Bool
compare :: Bol -> Bol -> Ordering
$ccompare :: Bol -> Bol -> Ordering
Ord, Int -> Bol
Bol -> Int
Bol -> [Bol]
Bol -> Bol
Bol -> Bol -> [Bol]
Bol -> Bol -> Bol -> [Bol]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Bol -> Bol -> Bol -> [Bol]
$cenumFromThenTo :: Bol -> Bol -> Bol -> [Bol]
enumFromTo :: Bol -> Bol -> [Bol]
$cenumFromTo :: Bol -> Bol -> [Bol]
enumFromThen :: Bol -> Bol -> [Bol]
$cenumFromThen :: Bol -> Bol -> [Bol]
enumFrom :: Bol -> [Bol]
$cenumFrom :: Bol -> [Bol]
fromEnum :: Bol -> Int
$cfromEnum :: Bol -> Int
toEnum :: Int -> Bol
$ctoEnum :: Int -> Bol
pred :: Bol -> Bol
$cpred :: Bol -> Bol
succ :: Bol -> Bol
$csucc :: Bol -> Bol
Enum, Bol
forall a. a -> a -> Bounded a
maxBound :: Bol
$cmaxBound :: Bol
minBound :: Bol
$cminBound :: Bol
Bounded, Int -> Bol -> ShowS
[Bol] -> ShowS
Bol -> [Char]
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [Bol] -> ShowS
$cshowList :: [Bol] -> ShowS
show :: Bol -> [Char]
$cshow :: Bol -> [Char]
showsPrec :: Int -> Bol -> ShowS
$cshowsPrec :: Int -> Bol -> ShowS
Show)
instance Solkattu.Notation Bol where
notation :: Bol -> (Style, BolT)
notation = BolT -> (Style, BolT)
Solkattu.textNotation forall b c a. (b -> c) -> (a -> b) -> a -> c
. BolT -> BolT
Text.toLower forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> BolT
showt
instance Pretty Bol where pretty :: Bol -> BolT
pretty = forall a. Notation a => a -> BolT
Solkattu.notationText
instance Expr.ToExpr Bol where
to_expr :: Bol -> Expr MiniVal
to_expr = forall val. Symbol -> Expr val
Expr.generator0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. BolT -> Symbol
Expr.Symbol forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Pretty a => a -> BolT
pretty
instance Expr.ToExpr (Realize.Stroke Bol) where
to_expr :: Stroke Bol -> Expr MiniVal
to_expr = forall a. ToExpr a => Stroke a -> Expr MiniVal
Realize.toExpr
parseBols :: BolT -> Either Error [Maybe Bols]
parseBols :: BolT -> Either BolT [Maybe Bols]
parseBols = forall sollu.
Show sollu =>
[(BolT, sollu)] -> BolT -> Either BolT [Maybe sollu]
Solkattu.parseSyllables [(BolT, Bols)]
allBols
allBols :: [(BolT, Bols)]
allBols :: [(BolT, Bols)]
allBols = [(BolT, Bols)]
sequences
forall a. [a] -> [a] -> [a]
++ forall a b. (a -> b) -> [a] -> [b]
map (forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second Bol -> Bols
S1) (forall a k. (a -> k) -> [a] -> [(k, a)]
Lists.keyOn forall a. Notation a => a -> BolT
Solkattu.notationText [forall a. Bounded a => a
minBound ..])
data Bols = S1 Bol | S2 Bol Bol
deriving (Int -> Bols -> ShowS
[Bols] -> ShowS
Bols -> [Char]
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [Bols] -> ShowS
$cshowList :: [Bols] -> ShowS
show :: Bols -> [Char]
$cshow :: Bols -> [Char]
showsPrec :: Int -> Bols -> ShowS
$cshowsPrec :: Int -> Bols -> ShowS
Show)
sequences :: [(BolT, Bols)]
sequences :: [(BolT, Bols)]
sequences =
[ (BolT
"tr", Bol -> Bol -> Bols
S2 Bol
Ti Bol
Ra)
, (BolT
"kt", Bol -> Bol -> Bols
S2 Bol
Ki Bol
Ta)
, (BolT
"tk", Bol -> Bol -> Bols
S2 Bol
Ta Bol
Ka)
]
bolMap :: Realize.SolluMap Bol Tabla.Stroke
Right (SolluMap Bol Stroke
bolMap, ) = forall stroke sollu g.
(Pretty stroke, Pretty sollu, Ord sollu) =>
[(Sequence g (Note sollu), [SNote stroke])]
-> Either
BolT
(SolluMap sollu stroke,
[(SolluMapKey sollu, [Maybe (Stroke stroke)])])
Realize.solluMap []