FW: Pattern guards vs. case (was, unfortunately :Re: interesting
example of laziness/ghc optimisation)
Simon Peyton-Jones
simonpj@microsoft.com
Thu, 1 Mar 2001 03:21:54 -0800
| * * * Ketil Malde <ketil@ii.uib.no> wrote:
|
| > ut - the converse is not true, is it? I can write
| >
| > ... = case foo of
| > (Foo f) -> ...
| > (Bar b) -> ...
| >
| > ut I can't express that as a pattern-guarded expression, can I?
Check out http://research.microsoft.com/~simonpj/Haskell/guards.html
which is implemented in GHC. Thus
f x | Foo a <- x = ...
| Bar b <- x = ...
Simon