From: simonpj Date: Tue, 8 Mar 2005 08:48:35 +0000 (+0000) Subject: [project @ 2005-03-08 08:48:35 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~957 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=c2c84b7142562656fdb86d18a6e84e0a5d31546c;hp=f97dcf9fc2ea2a419087bca53f2fea811c5181a9 [project @ 2005-03-08 08:48:35 by simonpj] Add notes about newtype deriving --- diff --git a/ghc/docs/users_guide/glasgow_exts.xml b/ghc/docs/users_guide/glasgow_exts.xml index a25d42e..efd7a13 100644 --- a/ghc/docs/users_guide/glasgow_exts.xml +++ b/ghc/docs/users_guide/glasgow_exts.xml @@ -3226,7 +3226,7 @@ class to the new type: As a result of this extension, all derived instances in newtype -declarations are treated uniformly (and implemented just by reusing + declarations are treated uniformly (and implemented just by reusing the dictionary for the representation type), except Show and Read, which really behave differently for the newtype and its representation. @@ -3307,6 +3307,14 @@ then we would not have been able to derive an instance for the classes usually have one "main" parameter for which deriving new instances is most interesting. +Lastly, all of this applies only for classes other than +Read, Show, Typeable, +and Data, for which the built-in derivation applies (section +4.3.3. of the Haskell Report). +(For the standard classes Eq, Ord, +Ix, and Bounded it is immaterial whether +the standard method is used or the one described here.) +