[Documentation for impredicative polymorphism simonpj@microsoft.com**20060907111540] { hunk ./docs/users_guide/glasgow_exts.xml 3201 - + +Impredicative polymorphism + +GHC supports impredicative polymorphism. This means +that you can call a polymorphic function at a polymorphic type, and +parameterise data structures over polymorphic types. For example: + + f :: Maybe (forall a. [a] -> [a]) -> Maybe ([Int], [Char]) + f (Just g) = Just (g [3], g "hello") + f Nothing = Nothing + +Notice here that the Maybe type is parameterised by the +polymorphic type (forall a. [a] -> +[a]). + +The technical details of this extension are described in the paper +Boxy types: +type inference for higher-rank types and impredicativity, +which appeared at ICFP 2006. + + hunk ./docs/users_guide/glasgow_exts.xml 3776 - The extensions to GHC are these: + +The rest of this section outlines the extensions to GHC that support GADTs. +It is far from comprehensive, but the design closely follows that described in +the paper Simple +unification-based type inference for GADTs, +which appeared in ICFP 2006. hunk ./docs/users_guide/glasgow_exts.xml 3925 -Template Haskell allows you to do compile-time meta-programming in Haskell. There is a "home page" for -Template Haskell at -http://www.haskell.org/th/, while -the background to +Template Haskell allows you to do compile-time meta-programming in +Haskell. +The background to hunk ./docs/users_guide/glasgow_exts.xml 3931 -The details of the Template Haskell design are still in flux. Make sure you -consult the online library reference material + + +There is a Wiki page about +Template Haskell at +http://www.haskell.org/th/, and that is the best place to look for +further details. +You may also +consult the online +Haskell library reference material hunk ./docs/users_guide/glasgow_exts.xml 3944 -Not all of these changes are in GHC 6.2.] +Not all of these changes are in GHC 6.6.] }