[Haskell-cafe] Mystery operator?

Jochem Berndsen jochem at functor.nl
Mon Nov 30 12:49:54 EST 2009


michael rice wrote:
> From: http://www.haskell.org/haskellwiki/Blow_your_mind#Polynomials
> 
>   -- splitting in two (alternating)
>   -- "1234567" -> ("1357", "246")
>   -- the lazy match with ~ is necessary for efficiency, especially enabling processing of infinite lists
>   foldr (\a ~(x,y) -> (a:y,x)) ([],[])
> 
> This works but can't find (~) operator anywhere. Please explain or site a reference.

This is called a "lazy pattern".
See:
http://www.haskell.org/tutorial/patterns.html
section 4.4

Cheers, Jochem
-- 
Jochem Berndsen | jochem at functor.nl | jochem@牛在田里.com


More information about the Haskell-Cafe mailing list