[Haskell-cafe] Std lib equivalent for liftM concat . sequence

Yitzchak Gale gale at sefer.org
Sun May 18 10:05:19 EDT 2008


Alistair Bayley wrote:
>> concatM :: Monad m => [m [a]] -> m [a]
>> concatM = liftM concat . sequence

Miguel Mitrofanov wrote:
> Seems to be close to
> sequence :: [ListT m a] -> ListT m a
> Hmm?

Yes. It is close to something like that for the old
broken ListT - but let's not talk about that one.

For "ListT done right", how about:

concatM :: Monad m => [ListT m a] -> List m a
concatM = join . liftList

(http://www.haskell.org/haskellwiki/ListT_done_right)

Regards,
Yitz


More information about the Haskell-Cafe mailing list