https://wiki.haskell.org/api.php?action=feedcontributions&user=Czheo&feedformat=atomHaskellWiki - User contributions [en]2024-03-29T10:14:48ZUser contributionsMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=Language_extensions&diff=64735Language extensions2021-09-09T05:36:34Z<p>Czheo: /* List of language extensions by name */</p>
<hr />
<div>Language extensions are used to enable language features in Haskell that may seem useful in certain cases. They can be used to loosen restrictions in the type system or add completely new language constructs to Haskell.<br />
<br />
They can be enabled using the [http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/pragmas.html#language-pragma LANGUAGE pragma] <br />
<br />
<hask><br />
{-# LANGUAGE <Extension>, <Extension> #-}<br />
</hask> <br />
<br />
or (in GHC) using [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/lang.html flags] <code>-X<Extension></code>. <br />
<br />
Before just using the language extension that fits your need, [[Use of language extensions|think about<br />
when it is useful]] and what risk it may bring to your program.<br />
<br />
== List of language extensions by name ==<br />
<br />
This list is far from complete and needs extension.<br />
<br />
* [[Datatype contexts|DatatypeContexts]] : Add type constraints to your datatype.<br />
* [[Default signatures|DefaultSignatures]]<br />
* Derive:<br />
** [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#deriving-typeable-instances DeriveDataTypeable]<br />
** [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-DeriveGeneric DeriveGeneric]<br />
** [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-DeriveFunctor DeriveFunctor]<br />
** [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-DeriveFoldable DeriveFoldable]<br />
** [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-DeriveTraversable DeriveTraversable]<br />
** [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-GeneralizedNewtypeDeriving GeneralizedNewtypeDeriving]<br />
* [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-DuplicateRecordFields DuplicateRecordFields] (GHC 8.0.1+) : Allow definition of record types with identically-named fields.<br />
* [[Existential type|ExistentialQuantification]]<br />
* [[Flexible contexts|FlexibleContexts]]<br />
* [[Flexiblae instances|FlexibleInstances]] : Allow a type parameter to occure twice within a type class instance.<br />
* [[Functional dependencies|FunctionalDependencies]] : Are used to constrain the parameters of type classes.<br />
* [[GADT]]s : Generalised algebraic datatypes - A more general approach to algebraic datatypes.<br />
* [[Implicit parameters|ImplicitParams]]<br />
* [[KindSignatures]]<br />
* [[Multi-parameter type class|MultiParamTypeClasses]] : Enable multiple type parameters in type classes.<br />
* [[Monomorphism restriction|NoMonomorphismRestriction]]<br />
* [[Overlapping instance|OverlappingInstances]]<br />
* [[Rank-N types|Rank2Types]]<br />
* [[Rank-N types|RankNTypes]]<br />
* [[Scoped type variables|ScopedTypeVariables]]<br />
* [[GHC/Stand-alone_deriving_declarations|StandaloneDeriving]]<br />
* [[Template Haskell|TemplateHaskell]]<br />
* {{GHCUsersGuide|exts/tuple_sections||section on TupleSections}} It allows tuples to be partially applied.<br />
* [[GHC/Type families|TypeFamilies]]<br />
* [[Undecidable instance|UndecidableInstances]]<br />
* [https://downloads.haskell.org/~ghc/8.10.3/docs/html/users_guide/glasgow_exts.html#extension-ViewPatterns ViewPatterns]<br />
* [[QualifiedDo]]<br />
<br />
= See also =<br />
<br />
* [[Use of language extensions]]<br />
<br />
<br />
[[Category:Language extensions]]</div>Czheo