Difference between revisions of "GHC/Type system"
From HaskellWiki
< GHC
(→Type signatures and ambiguity) |
(fix link to users guide) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
<span style='font-size: x-large; font-weight: bold'>Type system extensions in GHC</span> |
<span style='font-size: x-large; font-weight: bold'>Type system extensions in GHC</span> |
||
− | GHC comes with a rather large collection of type-system extensions (beyond Haskell 98). They are all documented in the [http://www.haskell.org/ghc/docs/latest/html/users_guide/ghc-language-features.html user manual], but this page is a place to record observations, notes, and suggestions on them. |
+ | GHC comes with a rather large collection of type-system extensions (beyond Haskell 98). They are all documented in the [http://www.haskell.org/ghc/docs/latest/html/users_guide/ghc-language-features.html user manual], but this page is a place to record user-oriented observations, notes, and suggestions on how to use them. |
− | |||
+ | * '''[[GHC/Indexed_types|Indexed data types]]''' |
||
− | |||
+ | * '''[[GHC/TypeHoles|Agda-like "holes" in GHC]]''' |
||
− | == Overlapping instances == |
||
+ | * '''[[GHC/Stand-alone deriving declarations|"Stand-alone deriving" declarations]]''' |
||
− | |||
+ | * '''[[GHC/TypeSigsAndAmbiguity|Type signatures and ambiguity]]''' |
||
− | GHC supports overlapping instances, with carefully specified rules. Make sure you read the [ |
+ | * '''Overlapping instances'''. GHC supports overlapping instances, with carefully specified rules. Make sure you read the [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html#instance-declarations relevant sections of the user manual]. Here is an application note about [[GHC/AdvancedOverlap|advanced use of overlapping instances]], combined with functional dependencies. |
− | + | * '''[[GHC/SuperClass|Super-Class Constraints: Type Families, Type Equalities, FunDep, Overlaps]]''' |
|
− | + | * '''[[GHC/Coercible|Safe coercions using Coercible]]''' |
|
− | |||
− | == Indexed data types and indexed newtypes == |
||
− | |||
− | [[GHC/Indexed_types|Indexed data types]] (including associated data types) are a very recent addition to GHC's type system extensions that is not yet included in the user manual. To use the extension, you need to obtain a version of GHC from [http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources its source repository]. |
||
− | |||
− | == Stand-alone deriving clauses == |
||
− | |||
− | Bjorn Bringert has recently implemented [[GHC/Stand-alone deriving declarations|"stand-alone deriving" declarations]]. |
||
− | |||
− | == Type holes == |
||
− | |||
− | Simon Peyton Jones, Sean Leather and Thijs Alkemade implemented [[GHC/TypeHoles|Agda-like "holes" in GHC]], which will ship in GHC 7.8.1. |
||
− | |||
− | ----------------------- |
Latest revision as of 06:11, 23 July 2020
Type system extensions in GHC
GHC comes with a rather large collection of type-system extensions (beyond Haskell 98). They are all documented in the user manual, but this page is a place to record user-oriented observations, notes, and suggestions on how to use them.
- Indexed data types
- Agda-like "holes" in GHC
- "Stand-alone deriving" declarations
- Type signatures and ambiguity
- Overlapping instances. GHC supports overlapping instances, with carefully specified rules. Make sure you read the relevant sections of the user manual. Here is an application note about advanced use of overlapping instances, combined with functional dependencies.
- Super-Class Constraints: Type Families, Type Equalities, FunDep, Overlaps
- Safe coercions using Coercible