module Derive.DDebug where
import qualified Util.Lists as Lists
import qualified Derive.Call.SubT as SubT
import qualified Derive.Derive as Derive
import qualified Derive.Score as Score
import qualified Derive.Stream as Stream
import qualified Perform.Pitch as Pitch
import Global
apply_sub :: Functor f => (a -> f b) -> SubT.EventT a -> f (SubT.EventT b)
apply_sub :: forall (f :: * -> *) a b.
Functor f =>
(a -> f b) -> EventT a -> f (EventT b)
apply_sub a -> f b
f (SubT.EventT ScoreTime
s ScoreTime
d a
n) = forall a. ScoreTime -> ScoreTime -> a -> EventT a
SubT.EventT ScoreTime
s ScoreTime
d forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
n
showr :: Maybe Derive.NoteDeriver -> Derive.Deriver Text
showr :: Maybe NoteDeriver -> Deriver Text
showr = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall (m :: * -> *) a. Monad m => a -> m a
return Text
"-") NoteDeriver -> Deriver Text
showd
showd :: Derive.NoteDeriver -> Derive.Deriver Text
showd :: NoteDeriver -> Deriver Text
showd NoteDeriver
d = do
[Event]
es <- forall a. Stream a -> [a]
Stream.events_of forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NoteDeriver
d
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"?" Note -> Text
Pitch.note_text forall a b. (a -> b) -> a -> b
$ Event -> Maybe Note
Score.initial_note forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< forall a. [a] -> Maybe a
Lists.head [Event]
es