[Haskell-cafe] Code walking off the right edge of the screen

Daniel Peebles pumpkingod at gmail.com
Sat Jun 20 15:21:59 EDT 2009


The when and unless functions might come in handy too (both have type
forall (m :: * -> *). (Monad m) => Bool -> m () -> m ())

On Sat, Jun 20, 2009 at 2:05 PM, Deniz Dogan<deniz.a.m.dogan at gmail.com> wrote:
> I (too) often find myself writing code such as this:
>
> if something
>  then putStrLn "howdy there!"
>  else if somethingElse
>          then putStrLn "howdy ho!"
>          else ...
>
> I recall reading some tutorial about how you can use the Maybe monad
> if your code starts looking like this, but as you can see, that
> doesn't really apply here. "something" and "somethingElse" are simply
> booleans and each of them have different actions to take if either of
> them is True.
>
> So how do I make code like this prettier?
>
> Thanks,
> Deniz Dogan
> _______________________________________________
> 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