
13 Mar
2013
13 Mar
'13
11:32 a.m.
Dear Haskellers, b) A related suggestion would be the addition of an
irrefutable swap, (swap'?), defined as
"swap ~(a,b) = (b,a)", and its addition to Prelude for
the same reasons.
If I define a function that matches on a single-constructor data type, such as (,), is there any reason against using ~? Like f (a,b) = ... instead of f ~(a,b) = ... ? I've seen that not using ~ can lead to problems sometimes, but not the other way around. (Of course changing the semantics of existing functions such as `swap` is problematic, my question targets the problem in general.) Best regards, Petr Pudlak