Language.Haskell.Exts.Extension

haskell-src-exts-1.11.1: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Portability | portable
Stability | transient
Maintainer | Niklas Broberg, d00nibro@chalmers.se

Language.Haskell.Exts.Extension

Contents

- Extensions
- Extension groups

Description

This entire module should be replaced with Language.Haskell.Extension from cabal, but we must wait for a release of cabal that includes the `XmlSyntax` and `RegularPatterns` extensions.

Synopsis

- data Extension
  - = OverlappingInstances
  - | UndecidableInstances
  - | IncoherentInstances
  - | RecursiveDo
  - | ParallelListComp
  - | MultiParamTypeClasses
  - | NoMonomorphismRestriction
  - | FunctionalDependencies
  - | ExplicitForall
  - | Rank2Types
  - | RankNTypes
  - | PolymorphicComponents
  - | ExistentialQuantification
  - | ScopedTypeVariables
  - | ImplicitParams
  - | FlexibleContexts
  - | FlexibleInstances
  - | EmptyDataDecls
  - | CPP
  - | KindSignatures
  - | BangPatterns
  - | TypeSynonymInstances
  - | TemplateHaskell
  - | ForeignFunctionInterface
  - | Arrows
  - | Generics
  - | NoImplicitPrelude
  - | NamedFieldPuns
  - | PatternGuards
  - | GeneralizedNewtypeDeriving
  - | ExtensibleRecords
  - | RestrictedTypeSynonyms
  - | HereDocuments
  - | MagicHash
  - | TypeFamilies
  - | StandaloneDeriving
  - | UnicodeSyntax
  - | PatternSignatures
  - | UnliftedFFITypes
  - | LiberalTypeSynonyms
  - | TypeOperators
  - | RecordWildCards
  - | RecordPuns
  - | DisambiguateRecordFields
  - | OverloadedStrings
  - | GADTs
  - | MonoPatBinds
  - | NoMonoPatBinds
  - | RelaxedPolyRec
  - | ExtendedDefaultRules
  - | UnboxedTuples
  - | DeriveDataTypeable
  - | ConstrainedClassMethods
  - | PackageImports
  - | ImpredicativeTypes
  - | NewQualifiedOperators
  - | PostfixOperators
  - | QuasiQuotes
  - | TransformListComp
  - | ViewPatterns
  - | XmlSyntax
  - | RegularPatterns
  - | TupleSections
  - | UnknownExtension String
- classifyExtension :: String -> Extension
- impliesExts :: [Extension] -> [Extension]
- glasgowExts :: [Extension]
- knownExtensions :: [Extension]

# Extensions

data Extension

This datatype is a copy of the one in Cabal's Language.Haskell.Extension module. The intention is to eventually import it from Cabal, but we need to wait for the next release of Cabal which includes XmlSyntax and RegularPatterns.

Constructors

OverlappingInstances |
UndecidableInstances |
IncoherentInstances |
RecursiveDo |
ParallelListComp |
MultiParamTypeClasses |
NoMonomorphismRestriction |
FunctionalDependencies |
ExplicitForall |
Rank2Types |
RankNTypes |
PolymorphicComponents |
ExistentialQuantification |
ScopedTypeVariables |
ImplicitParams |
FlexibleContexts |
FlexibleInstances |
EmptyDataDecls |
CPP |
KindSignatures |
BangPatterns |
TypeSynonymInstances |
TemplateHaskell |
ForeignFunctionInterface |
Arrows |
Generics |
NoImplicitPrelude |
NamedFieldPuns |
PatternGuards |
GeneralizedNewtypeDeriving |
ExtensibleRecords |
RestrictedTypeSynonyms |
HereDocuments |
MagicHash |
TypeFamilies |
StandaloneDeriving |
UnicodeSyntax |
PatternSignatures |
UnliftedFFITypes |
LiberalTypeSynonyms |
TypeOperators |
RecordWildCards |
RecordPuns |
DisambiguateRecordFields |
OverloadedStrings |
GADTs |
MonoPatBinds |
NoMonoPatBinds |
RelaxedPolyRec |
ExtendedDefaultRules |
UnboxedTuples |
DeriveDataTypeable |
ConstrainedClassMethods |
PackageImports |
ImpredicativeTypes |
NewQualifiedOperators |
PostfixOperators |
QuasiQuotes |
TransformListComp |
ViewPatterns |
XmlSyntax |
RegularPatterns |
TupleSections |
UnknownExtension String |

Instances

Eq Extension |
Ord Extension |
Read Extension |
Show Extension |
Enabled Extension |

classifyExtension :: String -> Extension

A clever version of read that returns an `UnknownExtension` if the string is not recognised.

impliesExts :: [Extension] -> [Extension]

Certain extensions imply other extensions, and this function makes the implication explicit. This also handles deprecated extensions, which imply their replacements. The returned valued is the transitive closure of implied extensions.

# Extension groups

glasgowExts :: [Extension]

The list of extensions enabled by GHC's portmanteau -fglasgow-exts flag.

knownExtensions :: [Extension]

List of all known extensions. Poor man's `Enum` instance (we can't enum with the `UnknownExtension` constructor).