X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fglasgow_exts.xml;h=09fd3f509fd4efbab42e79ee8ffaa3e7e508f797;hb=bebf54b1fefef0c337955ec1e653b44f4ec63d10;hp=f8ea3c72645da34b71d9bbea37386246c21f3dc6;hpb=90bbfd9f775c1018d6d5c4a9df7c3b277bb89e3d;p=ghc-hetmet.git diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index f8ea3c7..09fd3f5 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -3778,9 +3778,9 @@ pattern binding must have the same context. For example, this is fine: -Generalised Algebraic Data Types +Generalised Algebraic Data Types (GADTs) -Generalised Algebraic Data Types (GADTs) generalise ordinary algebraic data types by allowing you +Generalised Algebraic Data Types generalise ordinary algebraic data types by allowing you to give the type signatures of constructors explicitly. For example: data Term a where @@ -3801,7 +3801,12 @@ for these Terms: eval (If b e1 e2) = if eval b then eval e1 else eval e2 eval (Pair e1 e2) = (eval e1, eval e2) -These and many other examples are given in papers by Hongwei Xi, and Tim Sheard. +These and many other examples are given in papers by Hongwei Xi, and +Tim Sheard. There is a longer introduction +on the wiki, +and Ralf Hinze's +Fun with phantom types also has a number of examples. Note that papers +may use different notation to that implemented in GHC. The rest of this section outlines the extensions to GHC that support GADTs.