From f078c03636b809f4a8bc1caa1deecd58ff5491fe Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Sat, 23 Sep 2006 04:00:15 +0000 Subject: [PATCH] Improve documentation of newtype-deriving (todo: check formatting still works) --- docs/users_guide/glasgow_exts.xml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 0ca2a53..afb4447 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -3640,16 +3640,19 @@ declaration (after expansion of any type synonyms) where - The type t is an arbitrary type + The ci are partial applications of + classes of the form C t1'...tj', where the arity of C + is exactly j+1. That is, C lacks exactly one type argument. - The vk+1...vn are type variables which do not occur in - t, and + The k is chosen so that ci (T v1...vk) is well-kinded. - The ci are partial applications of - classes of the form C t1'...tj', where the arity of C - is exactly j+1. That is, C lacks exactly one type argument. + The type t is an arbitrary type. + + + The type variables vk+1...vn do not occur in t, + nor in the ci, and None of the ci is Read, Show, @@ -3662,13 +3665,8 @@ where Then, for each ci, the derived instance declaration is: - instance ci (t vk+1...v) => ci (T v1...vp) + instance ci t => ci (T v1...vk) -where p is chosen so that T v1...vp is of the -right kind for the last parameter of class Ci. - - - As an example which does not work, consider newtype NonMonad m s = NonMonad (State s m s) deriving Monad -- 1.7.10.4