
10 Jan
2005
10 Jan
'05
9:55 a.m.
On Sat, 8 Jan 2005, Lemming wrote:
Jon Cast wrote:
Absolutely. In Haskell's syntax, if-then-else-if interacts badly with do notation, and Haskell lacks a direct analogy to Lisp's cond.
case () of () | p1 -> e1 | p2 -> e2 ...
No problem:
select :: a -> [(Bool, a)] -> a select def = maybe def snd . List.find fst
Alternatively: select def = fromMaybe def . lookup True