[Haskell-cafe] Use forM_ with Maybe, it's Foldable!

John Wiegley johnw at fpcomplete.com
Sun Jan 27 06:55:53 CET 2013


>>>>> Felipe Almeida Lessa <felipe.lessa at gmail.com> writes:

> A few days ago I decided to hoogle the type of whenJust [2] and what I
> discovered is that

>   import Data.Foldable (forM_)
>   whenJust = forM_

You can also use "for_", if you want to use Applicative instead of Monad.

-- 
John Wiegley
FP Complete                         Haskell tools, training and consulting
http://fpcomplete.com               johnw on #haskell/irc.freenode.net



More information about the Haskell-Cafe mailing list