On 9/19/07, C.M.Brown <[EMAIL PROTECTED]> wrote:
> > f x = let
> > g (Just x) = x
> > g Nothing = error "Nothing"
> > in g x
> >
>
> That's interesting, thanks!
FYI, you may also use guards, even if you don't have a parameter. For
example, you may turn
f x = let k = if null x then 10 else head x
in froobar $ quox k
into
f x = let k | null x = 10
| otherwise = head x
in froobar $ quox k
Okay, this example is ugly, however it serves the purpose of
illustrating the idea =).
--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe