
20 Jun
2009
20 Jun
'09
7 p.m.
At Sat, 20 Jun 2009 20:45:16 +0200, Stephan Friedrichs wrote:
If it's a function, you can use guards:
foo :: ... foo something somethingElse | something -> putStrLn "howdy there!" | somethingElse -> putStrLn "howdy ho!" | otherwise -> ...
You can also artificially introduce places to use gaurds inside a function: foo = let x | 1 > 1 = "uh-oh" | otherwise = "all is well" in x bar = case () of _ | 1 > 1 -> "uh-oh" | otherwise -> "all is well" - jeremy