[Haskell-cafe] concatMap generalizes to msumMap?
S. Alexander Jacobson
alex at alexjacobson.com
Mon May 16 15:20:25 EDT 2005
I don't think that is right. concatMap has definition
concatMap :: (a -> [b]) -> [a] -> [b]
concatMap f xs = concat $ map f xs
Therefore:
msumMap :: (MonadPlus m) => (a1 -> m a) -> [a1] -> m a
msumMap f list = msum $ fmap f list
In contrast <<= has type
(=<<) :: (Monad m) => (a -> m b) -> m a -> m b
-Alex-
______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
On Mon, 16 May 2005, Tomasz Zielonka wrote:
> On Mon, May 16, 2005 at 02:57:42PM -0400, S. Alexander Jacobson wrote:
>> What is the name of the monadic generalization of concatMap?
>
> (=<<) or simply (>>=) if you don't care about argument order.
> Probably not what you are after?
>
>> In which lib is it located?
>
> The former is in module Monad, the latter in Prelude.
>
> Best regards
> Tomasz
>
> ** CRM114 Whitelisted by: tomasz.zielonka at gmail.com **
>
More information about the Haskell-Cafe
mailing list