Deniz Dogan 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 ...
>
> [...]
>
> So how do I make code like this prettier?
If it's a function, you can use guards:
foo :: ...
foo something somethingElse
| something -> putStrLn "howdy there!"
| somethingElse -> putStrLn "howdy ho!"
| otherwise -> ...
--
Früher hieß es ja: Ich denke, also bin ich.
Heute weiß man: Es geht auch so.
- Dieter Nuhr
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe