Neil Mitchell | 27 Aug 20:56
Picon
Gravatar

Re: Haskell symbol ~

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 undefined, g
undefined). If the pattern was strict (i.e. no ~) you would get
undefined.

Please update the keyword wiki so it makes sense to you, after you
have got your head round it.

Thanks

Neil

Gmane