[Haskell-beginners] Re: data constructors

Heinrich Apfelmus apfelmus at quantentunnel.de
Wed Apr 22 04:21:24 EDT 2009

Sterling Clover wrote:
> Maybe just bikeshedding here (and on -beginners, no less), but this
> seems like a job for Data.Traversable.sequence?
> sequence :: Monad m => t (m a) -> m (t a)
> Cheers,
> S.
> Heinrich Apfelmus wrote:
>>    convert :: Named [Timed Chord] -> Timed [Named Chord]

Great idea!

My type signature is wrong, it should actually read

   convert :: [Named [Timed Chord]] -> [Timed [Named Chord]]

I'm not sure whether  sequence  applies directly,

   type EventList a = [Timed a]

is not a monad. It's not quite an applicative functor either, because in

   (<*>) :: EventList (a -> b) -> EventList a -> EventList b

it's not clear what should happen to events from the left and right list
that are not simultaneous. This needs further thought.



More information about the Beginners mailing list