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

John Meacham john at repetae.net
Tue Oct 31 18:57:22 EST 2006


On Tue, Oct 31, 2006 at 02:42:58PM -0500, Seth Kurtzberg wrote:
> As to why it might be confusing, I realize this is extremely
> subjective.  Suppose you have a record type, and add a constructor to
> it.  As things stand, I can use the compiler to be certain that I've
> found all areas of the code that require changes because of the
> addition of the constructor (with the flag that tells gcc to find
> non-exhaustive pattern matches).  Using the compiler in this manner is
> (IMO) one of the things that makes refactering in Haskell so much
> easier than some other languages.
> 
> OK, now, if the pun feature is on, it's no longer illegal to provide
> processing for only one constructor.  (That's not the only thing it
> does, but that is one thing that it does.)

I am not sure what you mean here

data Foo = Foo { foo :: Int }

f Foo { .. } = foo

now if we change 
data Foo = Foo { foo :: Int } | Bar { bar :: Int }

then f gets an incomplete pattern match warning.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list