module Music.Theory.Bool where
import Data.List
ifThenElse :: Bool -> a -> a -> a
ifThenElse :: forall a. Bool -> a -> a -> a
ifThenElse Bool
p a
q a
r = if Bool
p then a
q else a
r
caseElse :: t -> [(Bool, t)] -> t
caseElse :: forall t. t -> [(Bool, t)] -> t
caseElse t
elseValue = forall b a. b -> (a -> b) -> Maybe a -> b
maybe t
elseValue forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find forall a b. (a, b) -> a
fst
caseOfElse :: Eq k => v -> k -> [(k, v)] -> v
caseOfElse :: forall k v. Eq k => v -> k -> [(k, v)] -> v
caseOfElse v
elseValue k
selectValue = forall b a. b -> (a -> b) -> Maybe a -> b
maybe v
elseValue forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find ((forall a. Eq a => a -> a -> Bool
== k
selectValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst)