22 Apr 2009 04:18
Re: Re: data constructors
Sterling Clover <s.clover <at> gmail.com>
2009-04-22 02:18:49 GMT
2009-04-22 02:18:49 GMT
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. On Apr 20, 2009, at 3:00 AM, Heinrich Apfelmus wrote: > > Functors sounds good to me. > > data Named a = N Name a > data Timed a = T Time a > > instance Functor Named where ... > instance Functor Timed where ... > > convert :: Named [Timed Chord] -> Timed [Named Chord] > > > Bu you can also use plain type synonyms > > type Named a = (Name,a) > type Timed a = (Time,a) > > and write your own record selectors by hand > > name :: Named a -> Name > name = fst(Continue reading)
RSS Feed