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

Copyright(c) Niklas Broberg 2009
LicenseBSD-style (see the file LICENSE.txt)
MaintainerNiklas Broberg, niklas.broberg@chalmers.se
Stabilitytransient
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Language.Haskell.Exts.Extension

Contents

Description

This module defines the list of recognized modular features of Haskell, most often (sloppily) referred to as "extensions".

Closely mimicking the Language.Haskell.Extension module from the Cabal library, this package also includes functionality for "computing" languages as sets of features. Also, we make no promise not to add extensions not yet recognized by Cabal.

Synopsis

Language definitions

data Language Source #

Constructors

Haskell98

The Haskell 98 language as defined by the Haskell 98 report. http://haskell.org/onlinereport/

Haskell2010

The Haskell 2010 language as defined by the Haskell 2010 report. http://www.haskell.org/onlinereport/haskell2010

HaskellAllDisabled

The minimal language resulting from disabling all recognized extensions - including ones that are part of all known language definitions e.g. MonomorphismRestriction.

UnknownLanguage String

An unknown language, identified by its name.

Instances

Eq Language Source # 
Data Language Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Language -> c Language #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Language #

toConstr :: Language -> Constr #

dataTypeOf :: Language -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Language) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Language) #

gmapT :: (forall b. Data b => b -> b) -> Language -> Language #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Language -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Language -> r #

gmapQ :: (forall d. Data d => d -> u) -> Language -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Language -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Language -> m Language #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Language -> m Language #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Language -> m Language #

Ord Language Source # 
Read Language Source # 
Show Language Source # 

Extensions

data Extension Source #

This represents language extensions beyond a base Language definition (such as Haskell98) that are supported by some implementations, usually in some special mode.

Constructors

EnableExtension KnownExtension

Enable a known extension

DisableExtension KnownExtension

Disable a known extension

UnknownExtension String

An unknown extension, identified by the name of its LANGUAGE pragma.

data KnownExtension Source #

Constructors

OverlappingInstances
GHC § 7.6.3.4
Allow overlapping class instances, provided there is a unique most specific instance for each use.
UndecidableInstances
GHC § 7.6.3.3
Ignore structural rules guaranteeing the termination of class instance resolution. Termination is guaranteed by a fixed-depth recursion stack, and compilation may fail if this depth is exceeded.
IncoherentInstances
GHC § 7.6.3.4
Implies OverlappingInstances. Allow the implementation to choose an instance even when it is possible that further instantiation of types will lead to a more specific instance being applicable.
InstanceSigs
GHC § 7.6.3.5
Allow type signatures in instances.
DoRec
GHC § 7.3.8
Allows recursive bindings in do blocks, using the rec keyword.
RecursiveDo
GHC § 7.3.8.2
Deprecated in GHC. Allows recursive bindings using mdo, a variant of do. DoRec provides a different, preferred syntax.
ParallelListComp
GHC § 7.3.9
Provide syntax for writing list comprehensions which iterate over several lists together, like the zipWith family of functions.
MultiParamTypeClasses
GHC § 7.6.1.1
Allow multiple parameters in a type class.
MonomorphismRestriction
GHC § 7.17
Enable the dreaded monomorphism restriction.
FunctionalDependencies
GHC § 7.6.2
Allow a specification attached to a multi-parameter type class which indicates that some parameters are entirely determined by others. The implementation will check that this property holds for the declared instances, and will use this property to reduce ambiguity in instance resolution.
Rank2Types
GHC § 7.8.5
Like RankNTypes but does not allow a higher-rank type to itself appear on the left of a function arrow.
RankNTypes
GHC § 7.8.5
Allow a universally-quantified type to occur on the left of a function arrow.
PolymorphicComponents
GHC § 7.8.5
Allow data constructors to have polymorphic arguments. Unlike RankNTypes, does not allow this for ordinary functions.
ExistentialQuantification
GHC § 7.4.4
Allow existentially-quantified data constructors.
ScopedTypeVariables
GHC § 7.8.7
Cause a type variable in a signature, which has an explicit forall quantifier, to scope over the definition of the accompanying value declaration.
PatternSignatures

Deprecated, use ScopedTypeVariables instead.

ImplicitParams
GHC § 7.8.3
Enable implicit function parameters with dynamic scope.
FlexibleContexts
GHC § 7.8.2
Relax some restrictions on the form of the context of a type signature.
FlexibleInstances
GHC § 7.6.3.2
Relax some restrictions on the form of the context of an instance declaration.
EmptyDataDecls
GHC § 7.4.1
Allow data type declarations with no constructors.
CPP
GHC § 4.10.3
Run the C preprocessor on Haskell source code.
KindSignatures
GHC § 7.8.4
Allow an explicit kind signature giving the kind of types over which a type variable ranges.
BangPatterns
GHC § 7.11
Enable a form of pattern which forces evaluation before an attempted match, and a form of strict let/where binding.
TypeSynonymInstances
GHC § 7.6.3.1
Allow type synonyms in instance heads.
TemplateHaskell
GHC § 7.9
Enable Template Haskell, a system for compile-time metaprogramming.
ForeignFunctionInterface
GHC § 8
Enable the Foreign Function Interface. In GHC, implements the standard Haskell 98 Foreign Function Interface Addendum, plus some GHC-specific extensions.
Arrows
GHC § 7.10
Enable arrow notation.
Generics
GHC § 7.16
Enable generic type classes, with default instances defined in terms of the algebraic structure of a type.
ImplicitPrelude
GHC § 7.3.11
Enable the implicit importing of the module Prelude. When disabled, when desugaring certain built-in syntax into ordinary identifiers, use whatever is in scope rather than the Prelude -- version.
NamedFieldPuns
GHC § 7.3.15
Enable syntax for implicitly binding local names corresponding to the field names of a record. Puns bind specific names, unlike RecordWildCards.
PatternGuards
GHC § 7.3.5
Enable a form of guard which matches a pattern and binds variables.
GeneralizedNewtypeDeriving
GHC § 7.5.4
Allow a type declared with newtype to use deriving for any class with an instance for the underlying type.
ExtensibleRecords
Hugs § 7.1
Enable the "Trex" extensible records system.
RestrictedTypeSynonyms
Hugs § 7.2
Enable type synonyms which are transparent in some definitions and opaque elsewhere, as a way of implementing abstract datatypes.
HereDocuments
Hugs § 7.3
Enable an alternate syntax for string literals, with string templating.
MagicHash
GHC § 7.3.2
Allow the character # as a postfix modifier on identifiers. Also enables literal syntax for unboxed values.
BinaryLiterals

Binary integer literals

TypeFamilies
GHC § 7.7
Allow data types and type synonyms which are indexed by types, i.e. ad-hoc polymorphism for types.
StandaloneDeriving
GHC § 7.5.2
Allow a standalone declaration which invokes the type class deriving mechanism.
UnicodeSyntax
GHC § 7.3.1
Allow certain Unicode characters to stand for certain ASCII character sequences, e.g. keywords and punctuation.
UnliftedFFITypes
GHC § 8.1.1
Allow the use of unboxed types as foreign types, e.g. in foreign import and foreign export.
LiberalTypeSynonyms
GHC § 7.4.3
Defer validity checking of types until after expanding type synonyms, relaxing the constraints on how synonyms may be used.
TypeOperators
GHC § 7.4.2
Allow the name of a type constructor, type class, or type variable to be an infix operator.
ParallelArrays
GHC § 7.26.5
Parallel arrays for Data Parallel Haskell.
RecordWildCards
GHC § 7.3.16
Enable syntax for implicitly binding local names corresponding to the field names of a record. A wildcard binds all unmentioned names, unlike NamedFieldPuns.
RecordPuns

Deprecated, use NamedFieldPuns instead.

DisambiguateRecordFields
GHC § 7.3.14
Allow a record field name to be disambiguated by the type of the record it's in.
OverloadedStrings
GHC § 7.6.4
Enable overloading of string literals using a type class, much like integer literals.
GADTs
GHC § 7.4.6
Enable generalized algebraic data types, in which type variables may be instantiated on a per-constructor basis. Implies GADTSyntax.
MonoPatBinds
GHC § 7.17.2
Make pattern bindings monomorphic.
RelaxedPolyRec
GHC § 7.8.8
Relax the requirements on mutually-recursive polymorphic functions.
ExtendedDefaultRules
GHC § 2.4.5
Allow default instantiation of polymorphic types in more situations.
UnboxedTuples
GHC § 7.2.2
Enable unboxed tuples.
DeriveDataTypeable
GHC § 7.5.3
Enable deriving for classes Data.Typeable.Typeable and Data.Generics.Data.
ConstrainedClassMethods
GHC § 7.6.1.3
Allow a class method's type to place additional constraints on a class type variable.
PackageImports
GHC § 7.3.18
Allow imports to be qualified by the package name the module is intended to be imported from, e.g.
import "network" Network.Socket
LambdaCase 
EmptyCase
GHC § 7.3.20
Allow case expressions with no alternatives.
ImpredicativeTypes
GHC § 7.8.6
Deprecated in GHC 6.12 and will be removed in GHC 7. Allow a type variable to be instantiated at a polymorphic type.
NewQualifiedOperators
GHC § 7.3.3
Change the syntax for qualified infix operators.
PostfixOperators
GHC § 7.3.12
Relax the interpretation of left operator sections to allow unary postfix operators.
QuasiQuotes
GHC § 7.9.5
Enable quasi-quotation, a mechanism for defining new concrete syntax for expressions and patterns.
TransformListComp
GHC § 7.3.10
Enable generalized list comprehensions, supporting operations such as sorting and grouping.
ViewPatterns
GHC § 7.3.6
Enable view patterns, which match a value by applying a function and matching on the result.
XmlSyntax

Allow concrete XML syntax to be used in expressions and patterns, as per the Haskell Server Pages extension language: http://www.haskell.org/haskellwiki/HSP. The ideas behind it are discussed in the paper "Haskell Server Pages through Dynamic Loading" by Niklas Broberg, from Haskell Workshop '05.

RegularPatterns

Allow regular pattern matching over lists, as discussed in the paper "Regular Expression Patterns" by Niklas Broberg, Andreas Farre and Josef Svenningsson, from ICFP '04.

TupleSections

Enables the use of tuple sections, e.g. (, True) desugars into x -> (x, True).

GHCForeignImportPrim

Allows GHC primops, written in C--, to be imported into a Haskell file.

NPlusKPatterns

Support for patterns of the form n + k, where k is an integer literal.

DoAndIfThenElse

Improve the layout rule when if expressions are used in a do block.

RebindableSyntax

Makes much of the Haskell sugar be desugared into calls to the function with a particular name that is in scope.

ExplicitForAll

Make forall a keyword in types, which can be used to give the generalisation explicitly.

DatatypeContexts

Allow contexts to be put on datatypes, e.g. the Eq a in data Eq a => Set a = NilSet | ConsSet a (Set a).

MonoLocalBinds

Local (let and where) bindings are monomorphic.

DeriveFunctor

Enable deriving for the Data.Functor.Functor class.

DeriveGeneric
GHC § 7.5.3
Enable deriving for the Generic and Generic1 classes.
DeriveTraversable

Enable deriving for the Data.Traversable.Traversable class.

DeriveFoldable

Enable deriving for the Data.Foldable.Foldable class.

NondecreasingIndentation

Enable non-decreasing indentation for 'do' blocks.

InterruptibleFFI
GHC § 8.1.4
Enable interruptible FFI.
CApiFFI
GHC § 8.1.5
Enable the capi calling convention in the foreign function interface.
JavaScriptFFI

GHCJS FFI extension with convenient import patterns, asynchronous FFI and a JSVal FFI type

ExplicitNamespaces
GHC § 7.3.27
Enable explicit namespaces in import/export.
DataKinds 
PolyKinds 
MultiWayIf
GHC § 7.3.16
Enable the multi-way if-expressions extension to accept conditional expressions with multiple branches.
SafeImports
GHC § 7.20.3
Allow imports to be qualified with a safe keyword that requires the imported module be trusted as according to the Safe Haskell definition of trust.
import safe Network.Socket
Safe
GHC § 7.20
Compile a module in the Safe, Safe Haskell mode -- a restricted form of the Haskell language to ensure type safety.
Trustworthy
GHC § 7.20
Compile a module in the Trustworthy, Safe Haskell mode -- no restrictions apply but the module is marked as trusted as long as the package the module resides in is trusted.
DefaultSignatures
GHC § 7.6.1.4
Allow default signatures in class definitions. They apply to default methods implemented in this class.
ConstraintKinds
GHC § 7.40
Allow type classimplicit parameterequality constraints to be used as types with the special kind Constraint. Also generalise the (ctxt => ty) syntax so that any type of kind Constraint can occur before the arrow.
RoleAnnotations
GHC § 7.25.3
Allow role annotations.
PatternSynonyms
GHC § 7.3.8
Enable giving names to parametrized pattern schemes
PartialTypeSignatures
GHC § 7.15
Allow partial specified type signatures. Note that this extension does not affect parsing. It only affects whether the program is able to be run with partial signatures.
NamedWildCards
GHC § 7.15.1.2
This extension treats type variables which start with an underscore as wildcards. For example, `foo :: _x` is equivalent to `foo :: _`.
TypeApplications 
TypeFamilyDependencies 
OverloadedLabels 

Instances

Bounded KnownExtension Source # 
Enum KnownExtension Source # 
Eq KnownExtension Source # 
Data KnownExtension Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> KnownExtension -> c KnownExtension #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c KnownExtension #

toConstr :: KnownExtension -> Constr #

dataTypeOf :: KnownExtension -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c KnownExtension) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c KnownExtension) #

gmapT :: (forall b. Data b => b -> b) -> KnownExtension -> KnownExtension #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> KnownExtension -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> KnownExtension -> r #

gmapQ :: (forall d. Data d => d -> u) -> KnownExtension -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> KnownExtension -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> KnownExtension -> m KnownExtension #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> KnownExtension -> m KnownExtension #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> KnownExtension -> m KnownExtension #

Ord KnownExtension Source # 
Read KnownExtension Source # 
Show KnownExtension Source # 

classifyExtension :: String -> Extension Source #

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

parseExtension :: String -> Extension Source #

Parse an enabled or disabled extension; returns UnknownExtension if the parse fails.

prettyExtension :: Extension -> String Source #

Pretty print an extension. Disabled extensions are prefixed with 'No'.

Extension groups

glasgowExts :: [Extension] Source #

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

knownExtensions :: [Extension] Source #

List of all known extensions, both "yes" and "no" versions.

deprecatedExtensions :: [(Extension, Maybe Extension)] Source #

Extensions that have been deprecated, possibly paired with another extension that replaces it.

Semantics of extensions applied to languages

impliesExts :: [KnownExtension] -> [KnownExtension] Source #

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