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

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to