[Haskell-cafe] Language semantics
Jon Cast
jcast at ou.edu
Fri Jun 29 18:24:15 EDT 2007
On Friday 29 June 2007, Andrew Coppin wrote:
> Jon Cast wrote:
> > On Wednesday 27 June 2007, Andrew Coppin wrote:
> >> Wow, wait a sec - case expressions are allowed to have guards too??
> >
> > Yes. I guess I assumed you knew that, sorry.
> >
> > The only syntactic (or semantic) difference between function equations
> > and case expressions (aside from the fact that case expressions require
> > you to tuple up the values you're pattern-matching on) is the fact that
> > case expressions use -> where function bindings use =. Other than that,
> > the two forms are exactly equivalent.
>
> I knew they were nearly identical. I didn't realise that they *were*
> identical!
>
> Hmm, I tried to find out 1 thing and actually found out 2 things! :-D
>
> I wonder what the layout for that is... something like this?
>
> case foo of
> patter1
>
> | guard1 -> ...
> | guard2 -> ...
>
> pattern2
>
> | guard3 -> ...
> | guard4 -> ...
Just so.
Jonathan Cast
http://sourceforge.net/projects/fid-core
http://sourceforge.net/projects/fid-emacs
More information about the Haskell-Cafe
mailing list