17 May
2005
17 May
'05
6:52 a.m.
S. Alexander Jacobson writes:
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
Assuming your goal is to generalize by replacing (++) with mplus, you want this: msumMap f = foldr (mplus . f) mzero It isn't in the standard libraries, so you'll have to define it yourself. -- David Menendez <zednenem@psualum.com> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> | of thermodynamics!"