> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Nicholls, Mark > > To recap... > > "type" introduces a synonym for another type, no new type is > created....it's for readabilities sake. > > "Newtype" introduces an isomorphic copy of an existing type...but > doesn't copy it's type class membership...the types are > disjoint/distinct but isomorphic (thus only 1 constructor param). > > "data" introduces a new type, and defines a composition of existing > types to create a new one based on "->" and "(". > > "class" introduces a constraint that any types declaring themselves to > be a member of this class...that functions must exist to satisfy the > constraint.
As an aside, I was wondering exactly what the differences are between newtype and data i.e. between > newtype A a = A a and > data A a = A a According to: http://www.haskell.org/onlinereport/decls.html#sect4.2.3 newtype is, umm, stricter than data i.e. newtype A undefined = undefined, but data A undefined = A undefined. Other than that, newtype just seems to be an optimization hint. Is that a more-or-less correct interpretation? Alistair ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ***************************************************************** _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe