[Haskell-beginners] Mapping inside State
Chaddaï Fouché
chaddai.fouche at gmail.com
Mon Mar 31 20:42:06 UTC 2014
Le 31 mars 2014 18:07, "martin" <martin.drautzburg at web.de> a écrit :
>
> Hello all,
>
> I found myselft writing this ugly piece of code
>
> silenceAll :: TI -> State (M.Map CH StringState,[DtzEvent]) TI
> silenceAll t =
Cut
>
> because I couldn't figure out how to map (silence t) over [0..6]. What is
the standard way of doing this
As said, mapM_ is the standard way to do that .
How could you have found this for yourself ? The recommended way would be
to use hoogle to search for the type signature you wish :
(Monad m) => (a -> m b) -> [a] -> m ()
mapM_ would be among the first results.
--
Jedaï
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140331/b6add265/attachment.html>
More information about the Beginners
mailing list