
I am poking around in Arrow to understand it better. There is the following definition: second :: a b c -> a (d,b) (d,c) second f = arr swap >>> first f >>> arr swap where swap :: (x,y) -> (y,x) swap ~(x,y) = (y,x) Can someone explain what the ~ is? Searching the net resulted in frustration. I kind of think it is some kind of equality constraint but can’t find documentation. Perhaps if I knew what it was called I might succeed in finding something. If it is an equality constraint, please provide a reference if you have one. I did not find anything in a search including GHC, etc. Thanks

Hi, Michael,
It's irrefutable pattern - the pattern that matches lazily. You can get
more info here [1].
Hope this helps,
Alexey Shmalko
[1]: http://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching
On Fri, May 15, 2015 at 4:17 AM Michael Jones
I am poking around in Arrow to understand it better. There is the following definition:
second :: a b c -> a (d,b) (d,c) second f = arr swap >>> first f >>> arr swap where swap :: (x,y) -> (y,x) swap ~(x,y) = (y,x)
Can someone explain what the ~ is? Searching the net resulted in frustration.
I kind of think it is some kind of equality constraint but can’t find documentation. Perhaps if I knew what it was called I might succeed in finding something. If it is an equality constraint, please provide a reference if you have one. I did not find anything in a search including GHC, etc.
Thanks _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Just in case it helps anyone's confusion, your equality constraint idea was on a reasonable track. When the ~ symbol appears *in a type signature* it is indeed an equality constraint. But in a pattern expression it's the marker for an irrefutable pattern. Regads,Ben ----- Original Message ----- From: "Alexey Shmalko" To:"Michael Jones" , "" Cc: Sent:Fri, 15 May 2015 01:26:23 +0000 Subject:Re: [Haskell-cafe] Equality Contstraint? Hi, Michael, It's irrefutable pattern - the pattern that matches lazily. You can get more info here [1]. Hope this helps,Alexey Shmalko [1]: http://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching [1] On Fri, May 15, 2015 at 4:17 AM Michael Jones wrote: I am poking around in Arrow to understand it better. There is the following definition: second :: a b c -> a (d,b) (d,c) second f = arr swap >>> first f >>> arr swap where swap :: (x,y) -> (y,x) swap ~(x,y) = (y,x) Can someone explain what the ~ is? Searching the net resulted in frustration. I kind of think it is some kind of equality constraint but can’t find documentation. Perhaps if I knew what it was called I might succeed in finding something If it is an equality constraint, please provide a reference if you have one. I did not find anything in a search including GHC, etc. Thanks _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org [3] http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe [4] Links: ------ [1] http://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching [2] mailto:mike@proclivis.com [3] mailto:Haskell-Cafe@haskell.org [4] http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Thanks, is there a recommended tutorial that walks through the type signatures of Arrow and sample implementations, and use in practice? Where the newbie reading it may need more hand holding. Sent from my iPad
On May 14, 2015, at 7:26 PM, Alexey Shmalko
wrote: Hi, Michael,
It's irrefutable pattern - the pattern that matches lazily. You can get more info here [1].
Hope this helps, Alexey Shmalko
[1]: http://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching
On Fri, May 15, 2015 at 4:17 AM Michael Jones
wrote: I am poking around in Arrow to understand it better. There is the following definition: second :: a b c -> a (d,b) (d,c) second f = arr swap >>> first f >>> arr swap where swap :: (x,y) -> (y,x) swap ~(x,y) = (y,x)
Can someone explain what the ~ is? Searching the net resulted in frustration.
I kind of think it is some kind of equality constraint but can’t find documentation. Perhaps if I knew what it was called I might succeed in finding something. If it is an equality constraint, please provide a reference if you have one. I did not find anything in a search including GHC, etc.
Thanks _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

On Thu, May 14, 2015 at 9:17 PM, Michael Jones
I kind of think it is some kind of equality constraint but can’t find documentation. Perhaps if I knew what it was called I might succeed in finding something. If it is an equality constraint, please provide a reference if you have one. I did not find anything in a search including GHC, etc.
~ is an equality constraint only in a type constraint (foo :: (x ~ y) => ...). In a pattern, it indicates the pattern matches lazily instead of the usual strict match. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Fri, 15 May 2015 03:17:07 +0200, Michael Jones
Can someone explain what the ~ is? Searching the net resulted in frustration.
The Hoogle at haskell.org[0] can help you, it leads to: https://wiki.haskell.org/Keywords#.7E The Hoogle version at fpcomplete.com doesn't handle keywords or standard operators any more. Regards, Henk-Jan van Tuyl [0] https://www.haskell.org/hoogle/ -- Folding@home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --
participants (6)
-
Alexey Shmalko
-
Ben
-
Brandon Allbery
-
Henk-Jan van Tuyl
-
Michael Jones
-
Proclivis