{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}
{-# LANGUAGE MultiWayIf #-}
{-# OPTIONS_HADDOCK show-extensions #-}
module Phladiprelio.Rhythmicity.PolyRhythm where
import GHC.Base
import GHC.Int
import GHC.Num (Num,(+),(-),(*),abs)
import GHC.Real
import GHC.List
import Text.Show
import Data.List (sort)
import Data.Maybe (fromJust,fromMaybe)
import Data.Char (toLower,isDigit)
import GHC.Float (int2Double,(**))
import qualified Phladiprelio.Rhythmicity.TwoFourth as TF
import Text.Read (readMaybe)
import qualified Data.Either as Either (Either(..))
data Marker4s = D | E | F | G deriving (Marker4s -> Marker4s -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Marker4s -> Marker4s -> Bool
$c/= :: Marker4s -> Marker4s -> Bool
== :: Marker4s -> Marker4s -> Bool
$c== :: Marker4s -> Marker4s -> Bool
Eq,Eq Marker4s
Marker4s -> Marker4s -> Bool
Marker4s -> Marker4s -> Ordering
Marker4s -> Marker4s -> Marker4s
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 :: Marker4s -> Marker4s -> Marker4s
$cmin :: Marker4s -> Marker4s -> Marker4s
max :: Marker4s -> Marker4s -> Marker4s
$cmax :: Marker4s -> Marker4s -> Marker4s
>= :: Marker4s -> Marker4s -> Bool
$c>= :: Marker4s -> Marker4s -> Bool
> :: Marker4s -> Marker4s -> Bool
$c> :: Marker4s -> Marker4s -> Bool
<= :: Marker4s -> Marker4s -> Bool
$c<= :: Marker4s -> Marker4s -> Bool
< :: Marker4s -> Marker4s -> Bool
$c< :: Marker4s -> Marker4s -> Bool
compare :: Marker4s -> Marker4s -> Ordering
$ccompare :: Marker4s -> Marker4s -> Ordering
Ord,Int -> Marker4s -> ShowS
[Marker4s] -> ShowS
Marker4s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Marker4s] -> ShowS
$cshowList :: [Marker4s] -> ShowS
show :: Marker4s -> String
$cshow :: Marker4s -> String
showsPrec :: Int -> Marker4s -> ShowS
$cshowsPrec :: Int -> Marker4s -> ShowS
Show)
newtype PolyMarkers = PolyMs Char deriving (PolyMarkers -> PolyMarkers -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolyMarkers -> PolyMarkers -> Bool
$c/= :: PolyMarkers -> PolyMarkers -> Bool
== :: PolyMarkers -> PolyMarkers -> Bool
$c== :: PolyMarkers -> PolyMarkers -> Bool
Eq,Eq PolyMarkers
PolyMarkers -> PolyMarkers -> Bool
PolyMarkers -> PolyMarkers -> Ordering
PolyMarkers -> PolyMarkers -> PolyMarkers
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 :: PolyMarkers -> PolyMarkers -> PolyMarkers
$cmin :: PolyMarkers -> PolyMarkers -> PolyMarkers
max :: PolyMarkers -> PolyMarkers -> PolyMarkers
$cmax :: PolyMarkers -> PolyMarkers -> PolyMarkers
>= :: PolyMarkers -> PolyMarkers -> Bool
$c>= :: PolyMarkers -> PolyMarkers -> Bool
> :: PolyMarkers -> PolyMarkers -> Bool
$c> :: PolyMarkers -> PolyMarkers -> Bool
<= :: PolyMarkers -> PolyMarkers -> Bool
$c<= :: PolyMarkers -> PolyMarkers -> Bool
< :: PolyMarkers -> PolyMarkers -> Bool
$c< :: PolyMarkers -> PolyMarkers -> Bool
compare :: PolyMarkers -> PolyMarkers -> Ordering
$ccompare :: PolyMarkers -> PolyMarkers -> Ordering
Ord)
instance Show PolyMarkers where
show :: PolyMarkers -> String
show (PolyMs Char
c) = Char
'P'forall a. a -> [a] -> [a]
:Char
' 'forall a. a -> [a] -> [a]
:[Char -> Char
toLower Char
c]
data PolyMrks = R4 Marker4s | RP PolyMarkers deriving (PolyMrks -> PolyMrks -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolyMrks -> PolyMrks -> Bool
$c/= :: PolyMrks -> PolyMrks -> Bool
== :: PolyMrks -> PolyMrks -> Bool
$c== :: PolyMrks -> PolyMrks -> Bool
Eq,Eq PolyMrks
PolyMrks -> PolyMrks -> Bool
PolyMrks -> PolyMrks -> Ordering
PolyMrks -> PolyMrks -> PolyMrks
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 :: PolyMrks -> PolyMrks -> PolyMrks
$cmin :: PolyMrks -> PolyMrks -> PolyMrks
max :: PolyMrks -> PolyMrks -> PolyMrks
$cmax :: PolyMrks -> PolyMrks -> PolyMrks
>= :: PolyMrks -> PolyMrks -> Bool
$c>= :: PolyMrks -> PolyMrks -> Bool
> :: PolyMrks -> PolyMrks -> Bool
$c> :: PolyMrks -> PolyMrks -> Bool
<= :: PolyMrks -> PolyMrks -> Bool
$c<= :: PolyMrks -> PolyMrks -> Bool
< :: PolyMrks -> PolyMrks -> Bool
$c< :: PolyMrks -> PolyMrks -> Bool
compare :: PolyMrks -> PolyMrks -> Ordering
$ccompare :: PolyMrks -> PolyMrks -> Ordering
Ord,Int -> PolyMrks -> ShowS
[PolyMrks] -> ShowS
PolyMrks -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolyMrks] -> ShowS
$cshowList :: [PolyMrks] -> ShowS
show :: PolyMrks -> String
$cshow :: PolyMrks -> String
showsPrec :: Int -> PolyMrks -> ShowS
$cshowsPrec :: Int -> PolyMrks -> ShowS
Show)
is4s :: PolyMrks -> Bool
is4s :: PolyMrks -> Bool
is4s (R4 Marker4s
_) = Bool
True
is4s PolyMrks
_ = Bool
False
isPoly :: PolyMrks -> Bool
isPoly :: PolyMrks -> Bool
isPoly (RP PolyMarkers
_) = Bool
True
isPoly PolyMrks
_ = Bool
False
data PolyRhythmBasis = PolyRhythm [Int] deriving (PolyRhythmBasis -> PolyRhythmBasis -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolyRhythmBasis -> PolyRhythmBasis -> Bool
$c/= :: PolyRhythmBasis -> PolyRhythmBasis -> Bool
== :: PolyRhythmBasis -> PolyRhythmBasis -> Bool
$c== :: PolyRhythmBasis -> PolyRhythmBasis -> Bool
Eq,Int -> PolyRhythmBasis -> ShowS
[PolyRhythmBasis] -> ShowS
PolyRhythmBasis -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolyRhythmBasis] -> ShowS
$cshowList :: [PolyRhythmBasis] -> ShowS
show :: PolyRhythmBasis -> String
$cshow :: PolyRhythmBasis -> String
showsPrec :: Int -> PolyRhythmBasis -> ShowS
$cshowsPrec :: Int -> PolyRhythmBasis -> ShowS
Show)
vals :: PolyRhythmBasis -> [Int]
vals :: PolyRhythmBasis -> [Int]
vals (PolyRhythm [Int]
xs) = [Int]
xs
data PolyChoices = PolyCh {
PolyChoices -> [Bool]
xn :: [Bool],
PolyChoices -> Int
pqty :: Int
} deriving PolyChoices -> PolyChoices -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolyChoices -> PolyChoices -> Bool
$c/= :: PolyChoices -> PolyChoices -> Bool
== :: PolyChoices -> PolyChoices -> Bool
$c== :: PolyChoices -> PolyChoices -> Bool
Eq
validPolyChRhPair :: PolyChoices -> PolyRhythmBasis
-> Bool
validPolyChRhPair :: PolyChoices -> PolyRhythmBasis -> Bool
validPolyChRhPair (PolyCh [Bool]
xs Int
n) (PolyRhythm [Int]
ys)
| [Int]
ks forall a. Ord a => a -> a -> Bool
<= [Int
0] = Bool
False
| forall a. (a -> Bool) -> [a] -> Bool
any (forall a. Ord a => a -> a -> Bool
<Int
0) [Int]
rs = Bool
False
| forall a. [a] -> Int
length [Bool]
xs forall a. Ord a => a -> a -> Bool
< Int
n Bool -> Bool -> Bool
&& forall a. Int -> [a] -> [a]
drop Int
l [Int]
ys forall a. Ord a => a -> a -> Bool
> [Int
0] Bool -> Bool -> Bool
&& Int
l forall a. Eq a => a -> a -> Bool
== forall a. [a] -> Int
length [Bool]
xs = Int
n forall a. Eq a => a -> a -> Bool
== forall a. Num a => [a] -> a
sum [Int]
ys
| Bool
otherwise = Bool
False
where ([Int]
ks,[Int]
rs) = forall a. Int -> [a] -> ([a], [a])
splitAt Int
1 [Int]
ys
l :: Int
l = forall a. [a] -> Int
length [Int]
ys forall a. Num a => a -> a -> a
- Int
1
data Intermediate a = J a | I PolyMarkers deriving (Intermediate a -> Intermediate a -> Bool
forall a. Eq a => Intermediate a -> Intermediate a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Intermediate a -> Intermediate a -> Bool
$c/= :: forall a. Eq a => Intermediate a -> Intermediate a -> Bool
== :: Intermediate a -> Intermediate a -> Bool
$c== :: forall a. Eq a => Intermediate a -> Intermediate a -> Bool
Eq, Intermediate a -> Intermediate a -> Bool
Intermediate a -> Intermediate a -> Ordering
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
forall {a}. Ord a => Eq (Intermediate a)
forall a. Ord a => Intermediate a -> Intermediate a -> Bool
forall a. Ord a => Intermediate a -> Intermediate a -> Ordering
forall a.
Ord a =>
Intermediate a -> Intermediate a -> Intermediate a
min :: Intermediate a -> Intermediate a -> Intermediate a
$cmin :: forall a.
Ord a =>
Intermediate a -> Intermediate a -> Intermediate a
max :: Intermediate a -> Intermediate a -> Intermediate a
$cmax :: forall a.
Ord a =>
Intermediate a -> Intermediate a -> Intermediate a
>= :: Intermediate a -> Intermediate a -> Bool
$c>= :: forall a. Ord a => Intermediate a -> Intermediate a -> Bool
> :: Intermediate a -> Intermediate a -> Bool
$c> :: forall a. Ord a => Intermediate a -> Intermediate a -> Bool
<= :: Intermediate a -> Intermediate a -> Bool
$c<= :: forall a. Ord a => Intermediate a -> Intermediate a -> Bool
< :: Intermediate a -> Intermediate a -> Bool
$c< :: forall a. Ord a => Intermediate a -> Intermediate a -> Bool
compare :: Intermediate a -> Intermediate a -> Ordering
$ccompare :: forall a. Ord a => Intermediate a -> Intermediate a -> Ordering
Ord)
isJI :: Intermediate a -> Bool
isJI :: forall a. Intermediate a -> Bool
isJI (J a
_) = Bool
True
isJI Intermediate a
_ = Bool
False
fromIntermediate :: Intermediate a -> Maybe PolyMrks
fromIntermediate :: forall a. Intermediate a -> Maybe PolyMrks
fromIntermediate (I PolyMarkers
k) = forall a. a -> Maybe a
Just (PolyMarkers -> PolyMrks
RP PolyMarkers
k)
fromIntermediate Intermediate a
_ = forall a. Maybe a
Nothing
getPolyChRhData
:: (Ord a) => Char
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> [[PolyMrks]]
getPolyChRhData :: forall a.
Ord a =>
Char
-> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> [[PolyMrks]]
getPolyChRhData Char
c Int
r choice :: PolyChoices
choice@(PolyCh [Bool]
ts Int
l1) rhythm :: PolyRhythmBasis
rhythm@(PolyRhythm [Int]
ys) [a]
xs
| Int
r forall a. Ord a => a -> a -> Bool
<= Int
4 Bool -> Bool -> Bool
&& PolyChoices -> PolyRhythmBasis -> Bool
validPolyChRhPair PolyChoices
choice PolyRhythmBasis
rhythm = forall a b. (a -> b) -> [a] -> [b]
map (forall {a}.
Ord a =>
PolyChoices -> PolyRhythmBasis -> [a] -> [PolyMrks]
g4 PolyChoices
choice PolyRhythmBasis
rhythm) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {a}. PolyChoices -> [a] -> [[a]]
f PolyChoices
choice forall a b. (a -> b) -> a -> b
$ [a]
xs
| Int
r forall a. Ord a => a -> a -> Bool
> Int
4 Bool -> Bool -> Bool
&& PolyChoices -> PolyRhythmBasis -> Bool
validPolyChRhPair PolyChoices
choice PolyRhythmBasis
rhythm =
forall a b. (a -> b) -> [a] -> [b]
map (\[a]
ks -> forall a b. (a -> b) -> [a] -> [b]
map (forall a. HasCallStack => Maybe a -> a
fromJust forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Intermediate a -> Maybe PolyMrks
fromIntermediate) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {a}.
Ord a =>
String
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> [Intermediate a]
-> [Intermediate a]
gPoly [Char
c..] PolyChoices
choice PolyRhythmBasis
rhythm [a]
ks forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall a. a -> Intermediate a
J forall a b. (a -> b) -> a -> b
$ [a]
ks) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {a}. PolyChoices -> [a] -> [[a]]
f PolyChoices
choice forall a b. (a -> b) -> a -> b
$ [a]
xs
| Bool
otherwise = forall a. HasCallStack => String -> a
error String
"Rhythmicity.PolyRhythm.getPolyChRhData: the first two arguments cannot be used together to get some meaningful result. "
where g4 :: PolyChoices -> PolyRhythmBasis -> [a] -> [PolyMrks]
g4 (PolyCh [Bool]
js Int
l) (PolyRhythm [Int]
ys) [a]
us = let ws :: [a]
ws = forall a. Ord a => [a] -> [a]
sort [a]
us in case ([Int]
ys,[Bool]
js) of
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
False,Bool
False,Bool
False]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
- Int
1)
!k2 :: a
k2 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
+ Int
x2 forall a. Num a => a -> a -> a
- Int
1)
!k3 :: a
k3 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
+ Int
x2 forall a. Num a => a -> a -> a
+ Int
x3 forall a. Num a => a -> a -> a
- Int
1) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
<= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
True,Bool
False,Bool
False]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1)
!k2 :: a
k2
| Int
x2 forall a. Ord a => a -> a -> Bool
< Int
2 = forall a. [a] -> a
head [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (Int
x2 forall a. Num a => a -> a -> a
- Int
1)
!k3 :: a
k3
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
head [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (Int
x2 forall a. Num a => a -> a -> a
+ Int
x3 forall a. Num a => a -> a -> a
- Int
1) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
>= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
False,Bool
True,Bool
False]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
- Int
1)
!k2 :: a
k2
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
last [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x2)
!k3 :: a
k3 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
+ Int
x3 forall a. Num a => a -> a -> a
- Int
1) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
<= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
False,Bool
False,Bool
True]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
- Int
1)
!k2 :: a
k2 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
+ Int
x2 forall a. Num a => a -> a -> a
- Int
1)
!k3 :: a
k3
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
last [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x3) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
<= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
True,Bool
True,Bool
False]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1)
!k2 :: a
k2 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1 forall a. Num a => a -> a -> a
- Int
x2 forall a. Num a => a -> a -> a
- Int
1)
!k3 :: a
k3
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
head [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (Int
x3 forall a. Num a => a -> a -> a
- Int
1) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
>= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
True,Bool
False,Bool
True]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1)
!k2 :: a
k2
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
head [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (Int
x2 forall a. Num a => a -> a -> a
- Int
1)
!k3 :: a
k3 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1 forall a. Num a => a -> a -> a
- Int
x3) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
>= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
<= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
False,Bool
True,Bool
True]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (Int
x1 forall a. Num a => a -> a -> a
- Int
1)
!k2 :: a
k2
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
last [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x2)
!k3 :: a
k3
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 = forall a. [a] -> a
last [a]
ws
| Bool
otherwise = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x2 forall a. Num a => a -> a -> a
- Int
x3) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
<= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
(Int
x1:Int
x2:Int
x3:[Int]
zs,[Bool
_,Bool
_,Bool
_]) -> let !k1 :: a
k1 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1)
!k2 :: a
k2 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1 forall a. Num a => a -> a -> a
- Int
x2)
!k3 :: a
k3 = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
x1 forall a. Num a => a -> a -> a
- Int
x2 forall a. Num a => a -> a -> a
- Int
x3) in
forall a b. (a -> b) -> [a] -> [b]
map (\a
t -> if
| a
t forall a. Ord a => a -> a -> Bool
>= a
k1 -> Marker4s -> PolyMrks
R4 Marker4s
D
| Int
x2 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k2 -> Marker4s -> PolyMrks
R4 Marker4s
E
| Int
x3 forall a. Eq a => a -> a -> Bool
== Int
0 -> Marker4s -> PolyMrks
R4 Marker4s
G
| a
t forall a. Ord a => a -> a -> Bool
>= a
k3 -> Marker4s -> PolyMrks
R4 Marker4s
F
| Bool
otherwise -> Marker4s -> PolyMrks
R4 Marker4s
G) [a]
us
gPoly :: String
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> [Intermediate a]
-> [Intermediate a]
gPoly String
wws (PolyCh (Bool
j:[Bool]
js) Int
l) (PolyRhythm (Int
y:[Int]
ys)) [a]
vs [Intermediate a]
us
| forall a. [a] -> Bool
null [a]
vs = forall a b. (a -> b) -> [a] -> [b]
map (\Intermediate a
r -> if | forall a. Intermediate a -> Bool
isJI Intermediate a
r -> (\q :: Intermediate a
q@(J a
rr) -> forall a. PolyMarkers -> Intermediate a
I (Char -> PolyMarkers
PolyMs (forall a. [a] -> a
head String
wws))) Intermediate a
r
| Bool
otherwise -> Intermediate a
r) [Intermediate a]
us
| Int
y forall a. Eq a => a -> a -> Bool
== Int
0 = forall a b. (a -> b) -> [a] -> [b]
map (\Intermediate a
r -> if | forall a. Intermediate a -> Bool
isJI Intermediate a
r -> (\q :: Intermediate a
q@(J a
rr) -> forall a. PolyMarkers -> Intermediate a
I (Char -> PolyMarkers
PolyMs (forall a. [a] -> a
head String
wws))) Intermediate a
r
| Bool
otherwise -> Intermediate a
r) [Intermediate a]
us
| Bool
otherwise = let ws :: [a]
ws = forall a. Ord a => [a] -> [a]
sort [a]
vs in case Bool
j of
Bool
False -> let !k :: a
k = [a]
ws forall a. [a] -> Int -> a
!! (Int
y forall a. Num a => a -> a -> a
- Int
1) in
String
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> [Intermediate a]
-> [Intermediate a]
gPoly (forall a. Int -> [a] -> [a]
drop Int
1 String
wws) ([Bool] -> Int -> PolyChoices
PolyCh [Bool]
js Int
l) ([Int] -> PolyRhythmBasis
PolyRhythm [Int]
ys) (forall a. (a -> Bool) -> [a] -> [a]
filter (forall a. Ord a => a -> a -> Bool
> a
k) [a]
vs)
(forall a b. (a -> b) -> [a] -> [b]
map (\Intermediate a
r -> if
| forall a. Intermediate a -> Bool
isJI Intermediate a
r -> (\q :: Intermediate a
q@(J a
rr) -> if
| a
rr forall a. Ord a => a -> a -> Bool
<= a
k -> forall a. PolyMarkers -> Intermediate a
I (Char -> PolyMarkers
PolyMs (forall a. [a] -> a
head String
wws))
| Bool
otherwise -> Intermediate a
q) Intermediate a
r
| Bool
otherwise -> Intermediate a
r) [Intermediate a]
us)
Bool
_ -> let !k :: a
k = [a]
ws forall a. [a] -> Int -> a
!! (forall a. [a] -> Int
length [a]
ws forall a. Num a => a -> a -> a
- Int
y) in
String
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> [Intermediate a]
-> [Intermediate a]
gPoly (forall a. Int -> [a] -> [a]
drop Int
1 String
wws) ([Bool] -> Int -> PolyChoices
PolyCh [Bool]
js Int
l) ([Int] -> PolyRhythmBasis
PolyRhythm [Int]
ys) (forall a. (a -> Bool) -> [a] -> [a]
filter (forall a. Ord a => a -> a -> Bool
< a
k) [a]
vs)
(forall a b. (a -> b) -> [a] -> [b]
map (\Intermediate a
r -> if
| forall a. Intermediate a -> Bool
isJI Intermediate a
r -> (\q :: Intermediate a
q@(J a
rr) -> if
| a
rr forall a. Ord a => a -> a -> Bool
>= a
k -> forall a. PolyMarkers -> Intermediate a
I (Char -> PolyMarkers
PolyMs (forall a. [a] -> a
head String
wws))
| Bool
otherwise -> Intermediate a
q) Intermediate a
r
| Bool
otherwise -> Intermediate a
r) [Intermediate a]
us)
gPoly String
wws (PolyCh [] Int
l) PolyRhythmBasis
_ [a]
vs [Intermediate a]
us = forall a b. (a -> b) -> [a] -> [b]
map (\Intermediate a
r -> if forall a. Intermediate a -> Bool
isJI Intermediate a
r then forall a. PolyMarkers -> Intermediate a
I (Char -> PolyMarkers
PolyMs (forall a. [a] -> a
head String
wws)) else Intermediate a
r) [Intermediate a]
us
f :: PolyChoices -> [a] -> [[a]]
f ch :: PolyChoices
ch@(PolyCh [Bool]
_ Int
l1) ys :: [a]
ys@(a
_:[a]
_) =
let !q :: Int
q = forall a. [a] -> Int
length [a]
ys forall a. Integral a => a -> a -> a
`quot` Int
l1
rs :: [a]
rs = forall a. Int -> [a] -> [a]
take (Int
q forall a. Num a => a -> a -> a
* Int
l1) [a]
ys in forall {a}. PolyChoices -> [a] -> [[a]]
f' PolyChoices
ch [a]
rs
f' :: PolyChoices -> [a] -> [[a]]
f' ch :: PolyChoices
ch@(PolyCh [Bool]
_ Int
l1) qs :: [a]
qs@(a
_:[a]
_) = let ([a]
ts,[a]
zs) = forall a. Int -> [a] -> ([a], [a])
splitAt Int
l1 [a]
qs in [a]
ts forall a. a -> [a] -> [a]
: PolyChoices -> [a] -> [[a]]
f' PolyChoices
ch [a]
zs
f' PolyChoices
_ [] = []
increasingF
:: Int
-> Double
-> Double
increasingF :: Int -> Double -> Double
increasingF Int
n Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 Bool -> Bool -> Bool
|| Double
x forall a. Ord a => a -> a -> Bool
< Double
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.increasingF: not defined for the arguments. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n forall a. [a] -> [a] -> [a]
++ String
" " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Double
x
| Double
x forall a. Eq a => a -> a -> Bool
== Double
0.0 = Double
0.001
| Int
n forall a. Eq a => a -> a -> Bool
== Int
1 = Double
x forall a. Num a => a -> a -> a
+ forall a. Ord a => a -> a -> a
min (Double
x forall a. Num a => a -> a -> a
* Double
0.25) Double
0.125
| Double
x forall a. Ord a => a -> a -> Bool
< Double
1 = Double
x forall a. Floating a => a -> a -> a
** (Double
1.0 forall a. Fractional a => a -> a -> a
/ Int -> Double
int2Double Int
n)
| Double
x forall a. Ord a => a -> a -> Bool
<= Double
1.1 = Double
x forall a. Num a => a -> a -> a
+ Double
1.0 forall a. Fractional a => a -> a -> a
/ Int -> Double
int2Double Int
n
| Bool
otherwise = Double
x forall a b. (Num a, Integral b) => a -> b -> a
^ Int
n
{-# INLINE increasingF #-}
increasingF1
:: Int
-> Double
-> Double
increasingF1 :: Int -> Double -> Double
increasingF1 Int
n Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.increasingF1: not defined for the argument. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n
| Bool
otherwise = Double
x forall a. Num a => a -> a -> a
+ Int -> Double
int2Double Int
n
{-# INLINE increasingF1 #-}
increasingFG
:: Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
increasingFG :: Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
increasingFG Int
n Double
k Int -> Double -> Double -> Double
f Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.increasingFG: not defined for the argument. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n
| Bool
otherwise = Double
x forall a. Num a => a -> a -> a
+ forall a. Num a => a -> a
abs (Int -> Double -> Double -> Double
f Int
n Double
k Double
x)
{-# INLINE increasingFG #-}
decreasingF1
:: Int
-> Double
-> Double
decreasingF1 :: Int -> Double -> Double
decreasingF1 Int
n Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.decreasingF1: not defined for the argument. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n
| Bool
otherwise = Double
x forall a. Num a => a -> a -> a
- Int -> Double
int2Double Int
n
{-# INLINE decreasingF1 #-}
decreasingFG
:: Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
decreasingFG :: Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
decreasingFG Int
n Double
k Int -> Double -> Double -> Double
f Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.decreasingFG: not defined for the argument. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n
| Bool
otherwise = Double
x forall a. Num a => a -> a -> a
- forall a. Num a => a -> a
abs (Int -> Double -> Double -> Double
f Int
n Double
k Double
x)
{-# INLINE decreasingFG #-}
decreasingFG2
:: Int
-> Double
-> (Double -> Double -> Double)
-> Double
-> Double
decreasingFG2 :: Int -> Double -> (Double -> Double -> Double) -> Double -> Double
decreasingFG2 Int
n Double
k Double -> Double -> Double
f Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.decreasingFG2: not defined for the argument. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n
| Bool
otherwise = Double
x forall a. Num a => a -> a -> a
- Int -> Double
int2Double Int
n forall a. Num a => a -> a -> a
* forall a. Num a => a -> a
abs (Double -> Double -> Double
f Double
k Double
x)
{-# INLINE decreasingFG2 #-}
increasingFG2
:: Int
-> Double
-> (Double -> Double -> Double)
-> Double
-> Double
increasingFG2 :: Int -> Double -> (Double -> Double -> Double) -> Double -> Double
increasingFG2 Int
n Double
k Double -> Double -> Double
f Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.increasingFG2: not defined for the argument. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n
| Bool
otherwise = Double
x forall a. Num a => a -> a -> a
+ Int -> Double
int2Double Int
n forall a. Num a => a -> a -> a
* forall a. Num a => a -> a
abs (Double -> Double -> Double
f Double
k Double
x)
{-# INLINE increasingFG2 #-}
decreasingF
:: Int
-> Double
-> Double
decreasingF :: Int -> Double -> Double
decreasingF Int
n Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
0 Bool -> Bool -> Bool
|| Double
x forall a. Ord a => a -> a -> Bool
< Double
0 = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Phladiprelio.Rhythmicity.PolyRhythm.decreasingF: not defined for the arguments. " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Int
n forall a. [a] -> [a] -> [a]
++ String
" " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Double
x
| Double
x forall a. Eq a => a -> a -> Bool
== Double
0.0 = Double
0.000000000001
| Int
n forall a. Eq a => a -> a -> Bool
== Int
1 = Double
x forall a. Num a => a -> a -> a
- forall a. Ord a => a -> a -> a
min (Double
x forall a. Num a => a -> a -> a
* Double
0.25) Double
0.125
| Double
x forall a. Ord a => a -> a -> Bool
< Double
1 = Double
x forall a. Floating a => a -> a -> a
** Int -> Double
int2Double Int
n
| Double
x forall a. Ord a => a -> a -> Bool
<= Double
1.1 = Double
1.0 forall a. Fractional a => a -> a -> a
/ (Double
x forall a. Num a => a -> a -> a
+ Double
1.0 forall a. Fractional a => a -> a -> a
/ Int -> Double
int2Double Int
n)
| Bool
otherwise = Double
x forall a. Floating a => a -> a -> a
** (Double
1.0 forall a. Fractional a => a -> a -> a
/ Int -> Double
int2Double Int
n)
{-# INLINE decreasingF #-}
similarityF1
:: Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityF1 :: Char -> PolyMrks -> PolyMrks -> Double -> Double
similarityF1 = Double
-> (Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG12 Double
1.0 (\Double
_ Double
_ -> Double
1.0)
{-# INLINE similarityF1 #-}
similarityF0
:: Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityF0 :: Char -> PolyMrks -> PolyMrks -> Double -> Double
similarityF0 = Double
-> (Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG02 Double
1.0 (\Double
_ Double
_ -> Double
1.0)
{-# INLINE similarityF0 #-}
similarityFGE1
:: Double
-> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE1 :: Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE1 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c PolyMrks
m1 PolyMrks
m2 Double
x
| PolyMrks -> Bool
is4s PolyMrks
m1 = let !h :: Int
h = case (\(R4 Marker4s
t0) -> Marker4s
t0) PolyMrks
m1 of { Marker4s
D -> Int
4 ; Marker4s
E -> Int
3 ; Marker4s
F -> Int
2 ; ~Marker4s
rrr -> Int
1 } in case PolyMrks
m1 forall a. Eq a => a -> a -> Bool
== PolyMrks
m2 of
Bool
True -> case Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f of
Either.Left Double -> Double -> Double
f2 -> Int -> Double -> (Double -> Double -> Double) -> Double -> Double
increasingFG2 Int
h Double
k Double -> Double -> Double
f2 Double
x
Either.Right Int -> Double -> Double -> Double
f3 -> Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
increasingFG Int
h Double
k Int -> Double -> Double -> Double
f3 Double
x
Bool
_ -> case Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f of
Either.Left Double -> Double -> Double
f2 -> Int -> Double -> (Double -> Double -> Double) -> Double -> Double
decreasingFG2 Int
h Double
k Double -> Double -> Double
f2 Double
x
Either.Right Int -> Double -> Double -> Double
f3 -> Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
decreasingFG Int
h Double
k Int -> Double -> Double -> Double
f3 Double
x
| Bool
otherwise = let l :: Int
l = forall a. [a] -> Int
length [Char
c..(\(RP (PolyMs Char
t0)) -> Char
t0) (forall a. Ord a => a -> a -> a
min PolyMrks
m1 PolyMrks
m2)] in
if
| PolyMrks
m1 forall a. Eq a => a -> a -> Bool
== PolyMrks
m2 -> case Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f of
Either.Left Double -> Double -> Double
f2 -> Int -> Double -> (Double -> Double -> Double) -> Double -> Double
increasingFG2 Int
l Double
k Double -> Double -> Double
f2 Double
x
Either.Right Int -> Double -> Double -> Double
f3 -> Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
increasingFG Int
l Double
k Int -> Double -> Double -> Double
f3 Double
x
| Bool
otherwise -> case Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f of
Either.Left Double -> Double -> Double
f2 -> Int -> Double -> (Double -> Double -> Double) -> Double -> Double
decreasingFG2 Int
l Double
k Double -> Double -> Double
f2 Double
x
Either.Right Int -> Double -> Double -> Double
f3 -> Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
decreasingFG Int
l Double
k Int -> Double -> Double -> Double
f3 Double
x
{-# INLINE similarityFGE1 #-}
similarityFG1
:: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG1 :: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG1 Double
k Int -> Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE1 Double
k (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE similarityFG1 #-}
similarityFG12
:: Double
-> (Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG12 :: Double
-> (Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG12 Double
k Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE1 Double
k (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE similarityFG12 #-}
similarityFGE0
:: Double
-> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE0 :: Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE0 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c PolyMrks
m1 PolyMrks
m2 Double
x
| PolyMrks -> Bool
is4s PolyMrks
m1 = let h :: Int
h = case (\(R4 Marker4s
t0) -> Marker4s
t0) PolyMrks
m1 of { Marker4s
D -> Int
4 ; Marker4s
E -> Int
3 ; Marker4s
F -> Int
2 ; ~Marker4s
rrr -> Int
1 } in case PolyMrks
m1 forall a. Eq a => a -> a -> Bool
== PolyMrks
m2 of
Bool
True -> case Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f of
Either.Left Double -> Double -> Double
f2 -> Int -> Double -> (Double -> Double -> Double) -> Double -> Double
increasingFG2 Int
h Double
k Double -> Double -> Double
f2 Double
x
Either.Right Int -> Double -> Double -> Double
f3 -> Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
increasingFG Int
h Double
k Int -> Double -> Double -> Double
f3 Double
x
Bool
_ -> Double
x
| Bool
otherwise = let l :: Int
l = forall a. [a] -> Int
length [Char
c..(\(RP (PolyMs Char
t0)) -> Char
t0) (forall a. Ord a => a -> a -> a
min PolyMrks
m1 PolyMrks
m2)] in
if
| PolyMrks
m1 forall a. Eq a => a -> a -> Bool
== PolyMrks
m2 -> case Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f of
Either.Left Double -> Double -> Double
f2 -> Int -> Double -> (Double -> Double -> Double) -> Double -> Double
increasingFG2 Int
l Double
k Double -> Double -> Double
f2 Double
x
Either.Right Int -> Double -> Double -> Double
f3 -> Int
-> Double
-> (Int -> Double -> Double -> Double)
-> Double
-> Double
increasingFG Int
l Double
k Int -> Double -> Double -> Double
f3 Double
x
| Bool
otherwise -> Double
x
{-# INLINE similarityFGE0 #-}
similarityFG0
:: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG0 :: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG0 Double
k Int -> Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE0 Double
k (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE similarityFG0 #-}
similarityFG02
:: Double
-> (Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG02 :: Double
-> (Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFG02 Double
k Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE0 Double
k (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE similarityFG02 #-}
similarityLogics
:: Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogics :: Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics Char
c Double
x0 (PolyMrks
x:[PolyMrks]
xs) (PolyMrks
y:[PolyMrks]
ys) = Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics Char
c (Char -> PolyMrks -> PolyMrks -> Double -> Double
similarityF1 Char
c PolyMrks
x PolyMrks
y Double
x0) [PolyMrks]
xs [PolyMrks]
ys
similarityLogics Char
c Double
x0 [PolyMrks]
_ [PolyMrks]
_ = Double
x0
similarityLogics0
:: Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogics0 :: Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics0 Char
c Double
x0 (PolyMrks
x:[PolyMrks]
xs) (PolyMrks
y:[PolyMrks]
ys) = Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics0 Char
c (Char -> PolyMrks -> PolyMrks -> Double -> Double
similarityF0 Char
c PolyMrks
x PolyMrks
y Double
x0) [PolyMrks]
xs [PolyMrks]
ys
similarityLogics0 Char
c Double
x0 [PolyMrks]
_ [PolyMrks]
_ = Double
x0
similarityLogicsGE
:: Double
-> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE :: Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
x0 (PolyMrks
x:[PolyMrks]
xs) (PolyMrks
y:[PolyMrks]
ys) = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c (Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE1 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c PolyMrks
x PolyMrks
y Double
x0) [PolyMrks]
xs [PolyMrks]
ys
similarityLogicsGE Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
x0 [PolyMrks]
_ [PolyMrks]
_ = Double
x0
similarityLogicsG1
:: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG1 :: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG1 Double
k Int -> Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE Double
k (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE similarityLogicsG1 #-}
similarityLogicsG12
:: Double
-> (Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG12 :: Double
-> (Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG12 Double
k Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE Double
k (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE similarityLogicsG12 #-}
similarityLogicsGE0
:: Double
-> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 :: Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
x0 (PolyMrks
x:[PolyMrks]
xs) (PolyMrks
y:[PolyMrks]
ys) = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c (Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> PolyMrks
-> PolyMrks
-> Double
-> Double
similarityFGE0 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c PolyMrks
x PolyMrks
y Double
x0) [PolyMrks]
xs [PolyMrks]
ys
similarityLogicsGE0 Double
k Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
x0 [PolyMrks]
_ [PolyMrks]
_ = Double
x0
similarityLogicsG0
:: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG0 :: Double
-> (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG0 Double
k Int -> Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 Double
k (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE similarityLogicsG0 #-}
similarityLogicsG02
:: Double
-> (Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG02 :: Double
-> (Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsG02 Double
k Double -> Double -> Double
f = Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 Double
k (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE similarityLogicsG02 #-}
similarityPoly
:: Char
-> Double
-> [[PolyMrks]]
-> Double
similarityPoly :: Char -> Double -> [[PolyMrks]] -> Double
similarityPoly Char
c Double
z [[PolyMrks]]
ts
| forall a. [a] -> Bool
null [[PolyMrks]]
ts = Double
z
| Bool
otherwise = [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
similarityPoly2 (forall a. [a] -> a
head [[PolyMrks]]
ts) Char
c Double
z [[PolyMrks]]
ts
{-# INLINE similarityPoly #-}
similarityPoly2
:: [PolyMrks]
-> Char
-> Double
-> [[PolyMrks]]
-> Double
similarityPoly2 :: [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
similarityPoly2 [PolyMrks]
ks Char
c Double
z ([PolyMrks]
xs:[PolyMrks]
ys:[[PolyMrks]]
xss) = [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
similarityPoly2 [PolyMrks]
ks Char
c (Double
z forall a. Num a => a -> a -> a
* Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics Char
c Double
z [PolyMrks]
xs [PolyMrks]
ys) ([PolyMrks]
ysforall a. a -> [a] -> [a]
:[[PolyMrks]]
xss)
similarityPoly2 [PolyMrks]
ks Char
c Double
z [[PolyMrks]
ys] = Double
z forall a. Num a => a -> a -> a
* Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics Char
c Double
z [PolyMrks]
ys [PolyMrks]
ks
similarityPoly2 [PolyMrks]
_ Char
_ Double
z [[PolyMrks]]
_ = Double
z
similarityPolyGEE
:: (Int,[PolyMrks])
-> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyGEE :: (Int, [PolyMrks])
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int, [PolyMrks])]
-> Double
similarityPolyGEE (Int, [PolyMrks])
r Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z ((Int
i,[PolyMrks]
xs):(Int
j,[PolyMrks]
ys):[(Int, [PolyMrks])]
xss) =
(Int, [PolyMrks])
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int, [PolyMrks])]
-> Double
similarityPolyGEE (Int, [PolyMrks])
r Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c (Double
z forall a. Num a => a -> a -> a
* Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE (Int -> Double
int2Double Int
i) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [PolyMrks]
xs [PolyMrks]
ys) ((Int
j,[PolyMrks]
ys)forall a. a -> [a] -> [a]
:[(Int, [PolyMrks])]
xss)
similarityPolyGEE (Int
_,[PolyMrks]
ts) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [(Int
j,[PolyMrks]
ys)] = Double
z forall a. Num a => a -> a -> a
* Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE (Int -> Double
int2Double Int
j) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [PolyMrks]
ys [PolyMrks]
ts
similarityPolyGEE (Int, [PolyMrks])
_ Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
_ Char
_ Double
z [(Int, [PolyMrks])]
_ = Double
z
similarityPolyGE
:: Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyGE :: Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [(Int, [PolyMrks])]
ts
| forall a. [a] -> Bool
null [(Int, [PolyMrks])]
ts = Double
z
| Bool
otherwise = (Int, [PolyMrks])
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int, [PolyMrks])]
-> Double
similarityPolyGEE (forall a. [a] -> a
head [(Int, [PolyMrks])]
ts) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [(Int, [PolyMrks])]
ts
{-# INLINE similarityPolyGE #-}
similarityPolyG1
:: (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyG1 :: (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyG1 Int -> Double -> Double -> Double
f = Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE similarityPolyG1 #-}
similarityPolyG12
:: (Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyG12 :: (Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyG12 Double -> Double -> Double
f = Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE similarityPolyG12 #-}
similarityPoly0
:: Char
-> Double
-> [[PolyMrks]]
-> Double
similarityPoly0 :: Char -> Double -> [[PolyMrks]] -> Double
similarityPoly0 Char
c Double
z [[PolyMrks]]
ts
| forall a. [a] -> Bool
null [[PolyMrks]]
ts = Double
z
| Bool
otherwise = [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
similarityPoly20 (forall a. [a] -> a
head [[PolyMrks]]
ts) Char
c Double
z [[PolyMrks]]
ts
{-# INLINE similarityPoly0 #-}
similarityPoly20
:: [PolyMrks]
-> Char
-> Double
-> [[PolyMrks]]
-> Double
similarityPoly20 :: [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
similarityPoly20 [PolyMrks]
ks Char
c Double
z ([PolyMrks]
xs:[PolyMrks]
ys:[[PolyMrks]]
xss) = [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
similarityPoly20 [PolyMrks]
ks Char
c (Double
z forall a. Num a => a -> a -> a
* Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics Char
c Double
z [PolyMrks]
xs [PolyMrks]
ys) ([PolyMrks]
ysforall a. a -> [a] -> [a]
:[[PolyMrks]]
xss)
similarityPoly20 [PolyMrks]
ks Char
c Double
z [[PolyMrks]
ys] = Double
z forall a. Num a => a -> a -> a
* Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
similarityLogics Char
c Double
z [PolyMrks]
ys [PolyMrks]
ks
similarityPoly20 [PolyMrks]
_ Char
_ Double
z [[PolyMrks]]
_ = Double
z
similarityPolyGEE0
:: (Int,[PolyMrks])
-> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyGEE0 :: (Int, [PolyMrks])
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int, [PolyMrks])]
-> Double
similarityPolyGEE0 (Int, [PolyMrks])
r Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z ((Int
i,[PolyMrks]
xs):(Int
j,[PolyMrks]
ys):[(Int, [PolyMrks])]
xss) =
(Int, [PolyMrks])
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int, [PolyMrks])]
-> Double
similarityPolyGEE0 (Int, [PolyMrks])
r Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c (Double
z forall a. Num a => a -> a -> a
* Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 (Int -> Double
int2Double Int
i) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [PolyMrks]
xs [PolyMrks]
ys) ((Int
j,[PolyMrks]
ys)forall a. a -> [a] -> [a]
:[(Int, [PolyMrks])]
xss)
similarityPolyGEE0 (Int
_,[PolyMrks]
ts) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [(Int
j,[PolyMrks]
ys)] = Double
z forall a. Num a => a -> a -> a
* Double
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [PolyMrks]
-> [PolyMrks]
-> Double
similarityLogicsGE0 (Int -> Double
int2Double Int
j) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [PolyMrks]
ys [PolyMrks]
ts
similarityPolyGEE0 (Int, [PolyMrks])
_ Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
_ Char
_ Double
z [(Int, [PolyMrks])]
_ = Double
z
similarityPolyGE0
:: Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyGE0 :: Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE0 Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [(Int, [PolyMrks])]
ts
| forall a. [a] -> Bool
null [(Int, [PolyMrks])]
ts = Double
z
| Bool
otherwise = (Int, [PolyMrks])
-> Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int, [PolyMrks])]
-> Double
similarityPolyGEE0 (forall a. [a] -> a
head [(Int, [PolyMrks])]
ts) Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
c Double
z [(Int, [PolyMrks])]
ts
{-# INLINE similarityPolyGE0 #-}
similarityPolyG0
:: (Int -> Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyG0 :: (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyG0 Int -> Double -> Double -> Double
f = Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE0 (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE similarityPolyG0 #-}
similarityPolyG02
:: (Double -> Double -> Double)
-> Char
-> Double
-> [(Int,[PolyMrks])]
-> Double
similarityPolyG02 :: (Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyG02 Double -> Double -> Double
f = Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE0 (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE similarityPolyG02 #-}
rhythmicityPoly
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPoly :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPoly Double
x0 Int
r PolyChoices
choices PolyRhythmBasis
rhythm = Char -> Double -> [[PolyMrks]] -> Double
similarityPoly Char
'a' Double
x0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a.
Ord a =>
Char
-> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> [[PolyMrks]]
getPolyChRhData Char
'a' Int
r PolyChoices
choices PolyRhythmBasis
rhythm
{-# INLINE rhythmicityPoly #-}
rhythmicityPolyGE
:: (Ord a) => Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyGE :: forall a.
Ord a =>
Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyGE Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Double
x0 Int
r PolyChoices
choices PolyRhythmBasis
rhythm = Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
'a' Double
x0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. [a] -> [b] -> [(a, b)]
zip [Int
0..] forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a.
Ord a =>
Char
-> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> [[PolyMrks]]
getPolyChRhData Char
'a' Int
r PolyChoices
choices PolyRhythmBasis
rhythm
{-# INLINE rhythmicityPolyGE #-}
rhythmicityPolyG1
:: (Ord a) => (Int -> Double -> Double -> Double)
-> Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyG1 :: forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG1 Int -> Double -> Double -> Double
f = forall a.
Ord a =>
Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyGE (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE rhythmicityPolyG1 #-}
rhythmicityPolyG12
:: (Ord a) => (Double -> Double -> Double)
-> Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyG12 :: forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG12 Double -> Double -> Double
f = forall a.
Ord a =>
Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyGE (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE rhythmicityPolyG12 #-}
rhythmicityPolyGE0
:: (Ord a) => Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyGE0 :: forall a.
Ord a =>
Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyGE0 Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Double
x0 Int
r PolyChoices
choices PolyRhythmBasis
rhythm = Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Char -> Double -> [(Int, [PolyMrks])] -> Double
similarityPolyGE0 Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
f Char
'a' Double
x0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. [a] -> [b] -> [(a, b)]
zip [Int
0..] forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a.
Ord a =>
Char
-> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> [[PolyMrks]]
getPolyChRhData Char
'a' Int
r PolyChoices
choices PolyRhythmBasis
rhythm
{-# INLINE rhythmicityPolyGE0 #-}
rhythmicityPolyG01
:: (Ord a) => (Int -> Double -> Double -> Double)
-> Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyG01 :: forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG01 Int -> Double -> Double -> Double
f = forall a.
Ord a =>
Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyGE0 (forall a b. b -> Either a b
Either.Right Int -> Double -> Double -> Double
f)
{-# INLINE rhythmicityPolyG01 #-}
rhythmicityPolyG02
:: (Ord a) => (Double -> Double -> Double)
-> Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyG02 :: forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG02 Double -> Double -> Double
f = forall a.
Ord a =>
Either
(Double -> Double -> Double) (Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyGE0 (forall a b. a -> Either a b
Either.Left Double -> Double -> Double
f)
{-# INLINE rhythmicityPolyG02 #-}
rhythmicityPoly0
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPoly0 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPoly0 Double
x0 Int
r PolyChoices
choices PolyRhythmBasis
rhythm = Char -> Double -> [[PolyMrks]] -> Double
similarityPoly0 Char
'a' Double
x0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a.
Ord a =>
Char
-> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> [[PolyMrks]]
getPolyChRhData Char
'a' Int
r PolyChoices
choices PolyRhythmBasis
rhythm
{-# INLINE rhythmicityPoly0 #-}
simpleF2 :: Double -> Double -> Double
simpleF2 :: Double -> Double -> Double
simpleF2 Double
k Double
x = Double
x forall a. Fractional a => a -> a -> a
/ (Double
k forall a. Num a => a -> a -> a
+ Double
1.0)forall a b. (Num a, Integral b) => a -> b -> a
^Integer
2
simpleF3 :: Int -> Double -> Double -> Double
simpleF3 :: Int -> Double -> Double -> Double
simpleF3 Int
n Double
k Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
2 = Double
x forall a. Fractional a => a -> a -> a
/ (Double
k forall a. Num a => a -> a -> a
+ Double
1.0)forall a b. (Num a, Integral b) => a -> b -> a
^Integer
2
| Bool
otherwise = forall a. Ord a => a -> a -> a
max Double
x (Double
x forall a b. (Num a, Integral b) => a -> b -> a
^ Int
n forall a. Fractional a => a -> a -> a
/ (Double
k forall a. Num a => a -> a -> a
+ Double
1.0)forall a b. (Num a, Integral b) => a -> b -> a
^Integer
2)
simpleEndF2 :: Double -> Double -> Double
simpleEndF2 :: Double -> Double -> Double
simpleEndF2 Double
k Double
x = Double
x forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0)forall a b. (Num a, Integral b) => a -> b -> a
^Integer
2
simpleEndF3 :: Int -> Double -> Double -> Double
simpleEndF3 :: Int -> Double -> Double -> Double
simpleEndF3 Int
n Double
k Double
x
| Int
n forall a. Ord a => a -> a -> Bool
<= Int
2 = Double
x forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0)forall a b. (Num a, Integral b) => a -> b -> a
^Integer
2
| Bool
otherwise = forall a. Ord a => a -> a -> a
max Double
x (Double
x forall a b. (Num a, Integral b) => a -> b -> a
^ Int
n forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0)forall a b. (Num a, Integral b) => a -> b -> a
^Integer
2)
rhythmicityPolyWeightedF2
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedF2 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedF2 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG12 (Double -> Double -> Double
simpleF2)
{-# INLINE rhythmicityPolyWeightedF2 #-}
rhythmicityPolyWeightedF3
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedF3 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedF3 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG1 (Int -> Double -> Double -> Double
simpleF3)
{-# INLINE rhythmicityPolyWeightedF3 #-}
rhythmicityPolyWeightedF20
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedF20 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedF20 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG02 (Double -> Double -> Double
simpleF2)
{-# INLINE rhythmicityPolyWeightedF20 #-}
rhythmicityPolyWeightedF30
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedF30 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedF30 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG01 (Int -> Double -> Double -> Double
simpleF3)
{-# INLINE rhythmicityPolyWeightedF30 #-}
rhythmicityPolyWeightedEF2
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedEF2 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedEF2 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG12 (Double -> Double -> Double
simpleEndF2)
{-# INLINE rhythmicityPolyWeightedEF2 #-}
rhythmicityPolyWeightedEF3
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedEF3 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedEF3 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG1 (Int -> Double -> Double -> Double
simpleEndF3)
{-# INLINE rhythmicityPolyWeightedEF3 #-}
rhythmicityPolyWeightedEF20
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedEF20 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedEF20 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG02 (Double -> Double -> Double
simpleEndF2)
{-# INLINE rhythmicityPolyWeightedEF20 #-}
rhythmicityPolyWeightedEF30
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedEF30 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedEF30 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG01 (Int -> Double -> Double -> Double
simpleEndF3)
{-# INLINE rhythmicityPolyWeightedEF30 #-}
linearF2 :: Double -> Double -> Double
linearF2 :: Double -> Double -> Double
linearF2 Double
k Double
x = Double
x forall a. Fractional a => a -> a -> a
/ (Double
6.0 forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0))
linearF3 :: Int -> Double -> Double -> Double
linearF3 :: Int -> Double -> Double -> Double
linearF3 Int
n Double
k Double
x = Int -> Double
int2Double Int
n forall a. Num a => a -> a -> a
* Double
x forall a. Fractional a => a -> a -> a
/ (Double
6.0 forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0))
linearEndF2 :: Double -> Double -> Double
linearEndF2 :: Double -> Double -> Double
linearEndF2 Double
k Double
x = Double
x forall a. Num a => a -> a -> a
* (Double
6.0 forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0))
linearEndF3 :: Int -> Double -> Double -> Double
linearEndF3 :: Int -> Double -> Double -> Double
linearEndF3 Int
n Double
k Double
x = Int -> Double
int2Double Int
n forall a. Num a => a -> a -> a
* Double
x forall a. Num a => a -> a -> a
* (Double
6.0 forall a. Num a => a -> a -> a
* (Double
k forall a. Num a => a -> a -> a
+ Double
1.0))
rhythmicityPolyWeightedLF2
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLF2 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLF2 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG12 (Double -> Double -> Double
linearF2)
{-# INLINE rhythmicityPolyWeightedLF2 #-}
rhythmicityPolyWeightedLF3
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLF3 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLF3 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG1 (Int -> Double -> Double -> Double
linearF3)
{-# INLINE rhythmicityPolyWeightedLF3 #-}
rhythmicityPolyWeightedLF20
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLF20 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLF20 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG02 (Double -> Double -> Double
linearF2)
{-# INLINE rhythmicityPolyWeightedLF20 #-}
rhythmicityPolyWeightedLF30
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLF30 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLF30 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG01 (Int -> Double -> Double -> Double
linearF3)
{-# INLINE rhythmicityPolyWeightedLF30 #-}
rhythmicityPolyWeightedLEF2
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLEF2 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLEF2 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG12 (Double -> Double -> Double
linearEndF2)
{-# INLINE rhythmicityPolyWeightedLEF2 #-}
rhythmicityPolyWeightedLEF3
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLEF3 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLEF3 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG1 (Int -> Double -> Double -> Double
linearEndF3)
{-# INLINE rhythmicityPolyWeightedLEF3 #-}
rhythmicityPolyWeightedLEF20
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLEF20 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLEF20 = forall a.
Ord a =>
(Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG02 (Double -> Double -> Double
linearEndF2)
{-# INLINE rhythmicityPolyWeightedLEF20 #-}
rhythmicityPolyWeightedLEF30
:: (Ord a) => Double
-> Int
-> PolyChoices
-> PolyRhythmBasis
-> [a]
-> Double
rhythmicityPolyWeightedLEF30 :: forall a.
Ord a =>
Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyWeightedLEF30 = forall a.
Ord a =>
(Int -> Double -> Double -> Double)
-> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
rhythmicityPolyG01 (Int -> Double -> Double -> Double
linearEndF3)
{-# INLINE rhythmicityPolyWeightedLEF30 #-}
data ParseChRh =
P0 String
| P1
TF.Choices
TF.RhythmBasis
Int
| P2
PolyChoices
PolyRhythmBasis
Int
Int
deriving ParseChRh -> ParseChRh -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParseChRh -> ParseChRh -> Bool
$c/= :: ParseChRh -> ParseChRh -> Bool
== :: ParseChRh -> ParseChRh -> Bool
$c== :: ParseChRh -> ParseChRh -> Bool
Eq
isChRhString :: ParseChRh -> Bool
isChRhString :: ParseChRh -> Bool
isChRhString (P0 String
_) = Bool
True
isChRhString ParseChRh
_ = Bool
False
isChRh3 :: ParseChRh -> Bool
isChRh3 :: ParseChRh -> Bool
isChRh3 (P1 Choices
_ RhythmBasis
_ Int
_) = Bool
True
isChRh3 ParseChRh
_ = Bool
False
isChRhPoly :: ParseChRh -> Bool
isChRhPoly :: ParseChRh -> Bool
isChRhPoly (P2 PolyChoices
_ PolyRhythmBasis
_ Int
_ Int
_) = Bool
True
isChRhPoly ParseChRh
_ = Bool
False
readRhythmicity :: String -> Maybe ParseChRh
readRhythmicity :: String -> Maybe ParseChRh
readRhythmicity ys :: String
ys@(Char
x:String
xs)
| ((Char
x forall a. Eq a => a -> [a] -> Bool
`elem` String
"cMN") Bool -> Bool -> Bool
|| (Char
x forall a. Ord a => a -> a -> Bool
>= Char
'A' Bool -> Bool -> Bool
&& Char
x forall a. Ord a => a -> a -> Bool
<= Char
'F')) Bool -> Bool -> Bool
&& Bool -> Bool
not (forall a. [a] -> Bool
null String
xs) = if
| Char -> Bool
isDigit forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> a
head forall a b. (a -> b) -> a -> b
$ String
xs -> let x :: Maybe Int
x = forall a. Read a => String -> Maybe a
readMaybe (forall a. Int -> [a] -> [a]
take Int
1 String
ts)::Maybe Int
y :: Maybe Int
y = forall a. Read a => String -> Maybe a
readMaybe (forall a. Int -> [a] -> [a]
drop Int
1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> [a] -> [a]
take Int
2 forall a b. (a -> b) -> a -> b
$ String
ts)::Maybe Int
z :: Maybe Int
z = forall a. Read a => String -> Maybe a
readMaybe (forall a. Int -> [a] -> [a]
drop Int
2 String
ts)::Maybe Int
ch :: Maybe Choices
ch = case (Maybe Int
x,Maybe Int
y,Maybe Int
z) of
(Just Int
x1, Just Int
y1, Just Int
z1) -> forall a. a -> Maybe a
Just (Int -> Int -> Int -> Choices
TF.Ch Int
x1 Int
y1 Int
z1)
(Maybe Int, Maybe Int, Maybe Int)
_ -> forall a. Maybe a
Nothing
x2 :: Maybe Int
x2 = forall a. Read a => String -> Maybe a
readMaybe (forall a. Int -> [a] -> [a]
take Int
1 String
ws)::Maybe Int
y2 :: Maybe Int
y2 = forall a. Read a => String -> Maybe a
readMaybe (forall a. Int -> [a] -> [a]
drop Int
1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> [a] -> [a]
take Int
2 forall a b. (a -> b) -> a -> b
$ String
ws)::Maybe Int
z2 :: Maybe Int
z2 = forall a. Read a => String -> Maybe a
readMaybe (forall a. Int -> [a] -> [a]
drop Int
2 String
ws)::Maybe Int
rh :: Maybe RhythmBasis
rh = case (Maybe Int
x2,Maybe Int
y2,Maybe Int
z2) of
(Just Int
x3, Just Int
y3, Just Int
z3) -> forall a. a -> Maybe a
Just (Int -> Int -> Int -> RhythmBasis
TF.Rhythm Int
x3 Int
y3 Int
z3)
(Maybe Int, Maybe Int, Maybe Int)
_ -> forall a. Maybe a
Nothing
n :: Maybe Int
n = forall a. Read a => String -> Maybe a
readMaybe String
ks::Maybe Int in
case (Maybe Choices
ch,Maybe RhythmBasis
rh,Maybe Int
n) of
(Just Choices
ch1,Just RhythmBasis
rh1,Just Int
n1) -> forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. Choices -> RhythmBasis -> Int -> ParseChRh
P1 Choices
ch1 RhythmBasis
rh1 forall a b. (a -> b) -> a -> b
$ forall {a}. Integral a => a -> a
f Int
n1
(Maybe Choices, Maybe RhythmBasis, Maybe Int)
_ -> forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ParseChRh
P0 forall a b. (a -> b) -> a -> b
$ String
ys
| forall a. [a] -> a
head String
xs forall a. Eq a => a -> a -> Bool
== Char
't' Bool -> Bool -> Bool
|| forall a. [a] -> a
head String
xs forall a. Eq a => a -> a -> Bool
== Char
'f' ->
let z :: Maybe Int
z = forall a. Read a => String -> Maybe a
readMaybe String
qs::Maybe Int
ch :: Maybe PolyChoices
ch = case Maybe Int
z of
Just Int
z1 -> forall a. a -> Maybe a
Just ([Bool] -> Int -> PolyChoices
PolyCh [Bool]
rs Int
z1)
Maybe Int
_ -> forall a. Maybe a
Nothing
n :: Maybe Int
n = forall a. Read a => String -> Maybe a
readMaybe String
ps::Maybe Int
m :: Maybe Int
m = forall a. Read a => String -> Maybe a
readMaybe String
ms::Maybe Int in
case (Maybe PolyChoices
ch,Maybe Int
n,Maybe Int
m) of
(Just PolyChoices
ch1,Just Int
n1,Just Int
m1) -> forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. PolyChoices -> PolyRhythmBasis -> Int -> Int -> ParseChRh
P2 PolyChoices
ch1 ([Int] -> PolyRhythmBasis
PolyRhythm [Int]
vs) Int
n1 forall a b. (a -> b) -> a -> b
$ forall {a}. Integral a => a -> a
f Int
m1
(Maybe PolyChoices, Maybe Int, Maybe Int)
_ -> forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ParseChRh
P0 forall a b. (a -> b) -> a -> b
$ String
ys
| Bool
otherwise -> forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ParseChRh
P0 forall a b. (a -> b) -> a -> b
$ String
ys
| Bool
otherwise = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ParseChRh
P0 forall a b. (a -> b) -> a -> b
$ String
ys
where (String
ts, String
us) = forall a. (a -> Bool) -> [a] -> ([a], [a])
break (forall a. Eq a => a -> a -> Bool
== Char
'+') String
xs
(String
ws,String
zs) = forall a. (a -> Bool) -> [a] -> ([a], [a])
break (forall a. Eq a => a -> a -> Bool
== Char
'=') forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> [a] -> [a]
drop Int
1 forall a b. (a -> b) -> a -> b
$ String
us
ks :: String
ks = forall a. Int -> [a] -> [a]
drop Int
1 String
zs
(String
ps,String
ns) = forall a. (a -> Bool) -> [a] -> ([a], [a])
break (forall a. Eq a => a -> a -> Bool
== Char
'*') String
ks
ms :: String
ms = forall a. Int -> [a] -> [a]
drop Int
1 String
ns
vs :: [Int]
vs = forall a b. (a -> b) -> [a] -> [b]
map (forall a. a -> Maybe a -> a
fromMaybe Int
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\String
t -> forall a. Read a => String -> Maybe a
readMaybe String
t::Maybe Int) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. a -> [a] -> [a]
:[])) String
ws
(String
ls,String
qs) = forall a. (a -> Bool) -> [a] -> ([a], [a])
break Char -> Bool
isDigit String
ts
rs :: [Bool]
rs = forall a b. (a -> b) -> [a] -> [b]
map (\Char
t -> if Char
t forall a. Eq a => a -> a -> Bool
== Char
't' then Bool
True else Bool
False) String
ls
f :: a -> a
f a
k
| a
k forall a. Integral a => a -> a -> a
`rem` a
4 forall a. Ord a => a -> a -> Bool
< a
0 = a
5 forall a. Num a => a -> a -> a
+ (a
k forall a. Integral a => a -> a -> a
`rem` a
4)
| Bool
otherwise = a
1 forall a. Num a => a -> a -> a
+ (a
k forall a. Integral a => a -> a -> a
`rem` a
4)