[Haskell-cafe] Are there any reasons against using ~ when matching one-constructor data types?

Petr Pudlák petr.mvd at gmail.com
Wed Mar 13 16:32:45 CET 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130313/9a077653/attachment.htm>


More information about the Haskell-Cafe mailing list