I personally think it's bad to start using "let-patterns" as a synonym for
general pattern bindings when explaining these concepts. It may be
true that it's all transformed into the same thing at core level, but a let
expression binds a definition at the expression level, rather than at the
equati
On Wed, 2008-08-27 at 20:14 +0100, C.M.Brown wrote:
> Hi,
>
> I may be wrong here, but I don't belive it's just let-patterns that have
> this property. I.e. what's the difference between...
>
> (Just x) = _|_
>
> f = x
>
> vs.
>
> f = let (Just x) = _|_ in x
>
> vs.
>
> f = x where (Just x)
Hi,
I may be wrong here, but I don't belive it's just let-patterns that have
this property. I.e. what's the difference between...
(Just x) = _|_
f = x
vs.
f = let (Just x) = _|_ in x
vs.
f = x where (Just x) = _|_
I believe Haskell uses Normal Order Reduction in all these cases. Why is
it j
Here is another example:
> f1 n ~(x:xs) = (n, x)
> f2 n (x:xs) = (n,x)
f1 5 [] = (5, error "irrefutable pattern match failure")
f2 5 [] = error "pattern match failure"
In particular:
fst (f1 5 []) = 5
fst (f2 5 []) = error "pattern match failure"
The "~" delays the pattern match until evaluati
Hi Maurício,
I've got one thing to add to the replies so far:
On Wed, Aug 27, 2008 at 8:23 PM, Maurício <[EMAIL PROTECTED]> wrote:
> What does '~' mean in Haskell? I
> read in haskell.org/haskellwiki/Keywords
> that "(...) Matching the pattern ~pat
> against a value always suceeds, and
> matchi
Hi
> At the same place, I found that example,
> but wasn't wise enough to figure out
> what it does:
>
> (f *** g) ~(x,y) = (f x, g y)
>
> Can you help me understand it?
It means exactly the same as:
(f *** g) xy = (f (fst xy), g (snd xy))
i.e. if you call (f *** g) undefined, you will get (f u
On 2008 Aug 27, at 14:23, Maurí cio wrote:
What does '~' mean in Haskell? I
read in haskell.org/haskellwiki/Keywords
that “(...) Matching the pattern ~pat
against a value always suceeds, and
matching will only diverge when one of
the variables bound in the pattern is
used.” Isn't that true for an
Hi,
What does '~' mean in Haskell? I
read in haskell.org/haskellwiki/Keywords
that “(...) Matching the pattern ~pat
against a value always suceeds, and
matching will only diverge when one of
the variables bound in the pattern is
used.” Isn't that true for any
variable, due to lazyness?
At the sa