Re: Record puns, time for removal?
"Richard A. O'Keefe" <[email protected]> Mon, 30 Oct 2006 14:20:29 +1300 (NZDT)
| Newsgroups | gmane.comp.lang.haskell.hugs.user |
|---|---|
| Message-ID | <[email protected]> |
What is a "record PUN"? Looking at the example,
> module Main where
> data Point = Point {x :: Int, y :: Int}
> main = print $ f $ Point 1 2
> f (Point{x}) = x
is the problem that "x" is used simultaneously as a field selector
and a variable?
Something very similar is accepted by SML/NJ:
datatype point = POINT of { x : int, y : int };
fun f (POINT {x, y}) = x;
print (Int.toString (f (POINT {x = 1, y = 2})) ^ "\n");
The MLton compiler also likes it.
I should also point out that it's not just Yhc and Hugs that like
the Haskell version; the copy of hbc I have also likes it.