[Haskell-cafe] How to make such code?

Antoine Latter aslatter at gmail.com
Thu Dec 30 04:43:47 CET 2010


Hi,

You're looking for 'when' as in:

> do
>  condition <- something
>  when condition $ other things
>  more things

http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:when

It is quite handy.

Take care,
Antoine

On Wed, Dec 29, 2010 at 10:14 PM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> Hi,
>  In Haskell's way, normally, we write:
> if condition then
>  expression_true
> else
>  expression_false
>
>  But I just heard that, in fancy way, we could do:
> do
>  ifNeedToDo >> doIt
>  bluh
>
>  May I have any clue here?
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list