
Yes, makes sense, I always thought of the projection functions as being
secondary. Thanks
On 14 July 2010 11:00, Brent Yorgey
On Wed, Jul 14, 2010 at 10:39:23AM +0100, Tom Doris wrote:
Can someone give an explanation of the use of record syntax in newtype declarations that helps one understand how it's meant to be interpreted? I understand the "facts" according to the language definition, but I just don't see why this notation was used; does it have any relationship with records?
Yes, the reason this notation is used is that it corresponds exactly to defining a record containing one field. Declaring field names in a record really just gives you some projection functions to get the fields out (and also some pattern-matching magic); declaring a field name in a newtype gives you a projection function to unwrap the newtype.
Does that help?
-Brent _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners