[Hugs-users] Record puns, time for removal?

Richard A. O'Keefe ok at cs.otago.ac.nz
Sun Oct 29 20:20:29 EST 2006


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.



More information about the Hugs-Users mailing list