[Haskell-cafe] Mystery operator?

michael rice nowgate at yahoo.com
Mon Nov 30 14:01:04 EST 2009


Hi all,

A lot of things posted here I wasn't aware of. My original example involved ~(x,y), so, returning to that context, how would these two simple cases vary:

add2 :: (Int,Int) -> Int
add2 (x,y) = x+y

add2 :: (Int,Int) -> Int
add2 ~(x,y) = x+y

I guess what I'm looking for is the concept that would dictate choosing one over the other.

Thanks,

Michael



--- On Mon, 11/30/09, Daniel Fischer <daniel.is.fischer at web.de> wrote:

From: Daniel Fischer <daniel.is.fischer at web.de>
Subject: Re: [Haskell-cafe] Mystery operator?
To: haskell-cafe at haskell.org
Date: Monday, November 30, 2009, 1:35 PM

Am Montag 30 November 2009 19:32:01 schrieb Brandon S. Allbery KF8NH:
> On Nov 30, 2009, at 13:26 , michael rice wrote:
> > So, ALL patterns are strict, unless one precedes them with "~"?
>
> "case" patterns are strict (this includes pattern matching in function
> arguments).
> "let" patterns are lazy.

And of course, wildcard patterns (_) and variable patterns (var) are lazy too.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091130/ace2d16f/attachment.html


More information about the Haskell-Cafe mailing list