|
|
|
|
|
Description |
Abstract syntax of global declarations.
Definitions for: TyDecl and ConDecl, ClassDecl,
InstDecl, DefaultDecl and ForeignDecl.
|
|
Synopsis |
|
|
|
|
Toplevel declarations
|
|
data HsDecl id |
A Haskell Declaration
| Constructors | | Instances | |
|
|
type LHsDecl id = Located (HsDecl id) |
|
Class or type declarations
|
|
data TyClDecl name |
A type or class declaration.
| Constructors | ForeignType | | | TyFamily | type/data family T :: *->* | | TyData | Declares a data type or newtype, giving its construcors
data/newtype T a = constrs
data/newtype instance T [a] = constrs
| tcdND :: NewOrData | | tcdCtxt :: LHsContext name | Context
| tcdLName :: Located name | | tcdTyVars :: [LHsTyVarBndr name] | | tcdTyPats :: Maybe [LHsType name] | Type patterns.
Just [t1..tn] for data instance T t1..tn = ...
in this case tcdTyVars = fv( tcdTyPats ).
Nothing for everything else.
| tcdKindSig :: Maybe Kind | Optional kind signature.
(Just k) for a GADT-style data, or data
instance decl with explicit kind sig
| tcdCons :: [LConDecl name] | Data constructors
For data T a = T1 | T2 a
the LConDecls all have ResTyH98.
For data T a where { T1 :: T a }
the LConDecls all have ResTyGADT.
| tcdDerivs :: Maybe [LHsType name] | Derivings; Nothing => not specified,
Just [] => derive exactly what is asked
These types must be of form
forall ab. C ty1 ty2
Typically the foralls and ty args are empty, but they
are non-empty for the newtype-deriving case
|
| TySynonym | | tcdLName :: Located name | | tcdTyVars :: [LHsTyVarBndr name] | | tcdTyPats :: Maybe [LHsType name] | Type patterns.
Just [t1..tn] for data instance T t1..tn = ...
in this case tcdTyVars = fv( tcdTyPats ).
Nothing for everything else.
| tcdSynRhs :: LHsType name | synonym expansion
|
| ClassDecl | | |
| Instances | |
|
|
type LTyClDecl name = Located (TyClDecl name) |
|
isClassDecl :: TyClDecl name -> Bool |
type class
|
|
isSynDecl :: TyClDecl name -> Bool |
vanilla Haskell type synonym (ie, not a type instance)
|
|
isDataDecl :: TyClDecl name -> Bool |
True = argument is a data/newtype or data/newtype instance
declaration.
|
|
isTypeDecl :: TyClDecl name -> Bool |
type or type instance declaration
|
|
isFamilyDecl :: TyClDecl name -> Bool |
type family declaration
|
|
isFamInstDecl :: TyClDecl name -> Bool |
family instance (types, newtypes, and data types)
|
|
tcdName :: TyClDecl name -> name |
|
tyClDeclNames :: Eq name => TyClDecl name -> [Located name] |
Returns all the binding names of the decl, along with their SrcLocs.
The first one is guaranteed to be the name of the decl. For record fields
mentioned in multiple constructors, the SrcLoc will be from the first
occurence. We use the equality to filter out duplicate field names
|
|
tyClDeclTyVars :: TyClDecl name -> [LHsTyVarBndr name] |
|
countTyClDecls :: [TyClDecl name] -> (Int, Int, Int, Int, Int, Int) |
|
Instance declarations
|
|
data InstDecl name |
Constructors | | Instances | |
|
|
type LInstDecl name = Located (InstDecl name) |
|
data NewOrData |
Constructors | NewType | newtype Blah ... | DataType | data Blah ... |
| Instances | |
|
|
data FamilyFlavour |
Constructors | TypeFamily | type family ... | DataFamily | data family ... |
|
|
|
instDeclATs :: InstDecl name -> [LTyClDecl name] |
|
Standalone deriving declarations
|
|
data DerivDecl name |
Constructors | | Instances | |
|
|
type LDerivDecl name = Located (DerivDecl name) |
|
RULE declarations
|
|
data RuleDecl name |
Constructors | | Instances | |
|
|
type LRuleDecl name = Located (RuleDecl name) |
|
data RuleBndr name |
Constructors | | Instances | |
|
|
collectRuleBndrSigTys :: [RuleBndr name] -> [LHsType name] |
|
default declarations
|
|
data DefaultDecl name |
Constructors | | Instances | |
|
|
type LDefaultDecl name = Located (DefaultDecl name) |
|
Top-level template haskell splice
|
|
data SpliceDecl id |
Constructors | | Instances | |
|
|
Foreign function interface declarations
|
|
data ForeignDecl name |
Constructors | | Instances | |
|
|
type LForeignDecl name = Located (ForeignDecl name) |
|
data ForeignImport |
Constructors | | Instances | |
|
|
data ForeignExport |
Constructors | | Instances | |
|
|
data CImportSpec |
|
|
Data-constructor declarations
|
|
data ConDecl name |
Constructors | ConDecl | | con_name :: Located name | Constructor name. This is used for the DataCon itself, and for
the user-callable wrapper Id.
| con_explicit :: HsExplicitForAll | Is there an user-written forall? (cf. HsForAllTy)
| con_qvars :: [LHsTyVarBndr name] | Type variables. Depending on con_res this describes the
follewing entities
- ResTyH98: the constructor's *existential* type variables
- ResTyGADT: *all* the constructor's quantified type variables
| con_cxt :: LHsContext name | The context. This does not include the "stupid theta" which
lives only in the TyData decl.
| con_details :: HsConDeclDetails name | The main payload
| con_res :: ResType name | Result type of the constructor
| con_doc :: Maybe LHsDocString | A possible Haddock comment.
| con_old_rec :: Bool | TEMPORARY field; True = user has employed now-deprecated syntax for
GADT-style record decl C { blah } :: T a b
Remove this when we no longer parse this stuff, and hence do not
need to report decprecated use
|
|
| Instances | |
|
|
type LConDecl name = Located (ConDecl name) |
|
data ResType name |
Constructors | | Instances | |
|
|
type HsConDeclDetails name = HsConDetails (LBangType name) [ConDeclField name] |
|
hsConDeclArgTys :: HsConDeclDetails name -> [LBangType name] |
|
hsConDeclsNames :: Eq name => [LConDecl name] -> [Located name] |
|
Document comments
|
|
data DocDecl |
Constructors | | Instances | |
|
|
type LDocDecl = Located DocDecl |
|
docDeclDoc :: DocDecl -> HsDocString |
|
Deprecations
|
|
data WarnDecl name |
Constructors | | Instances | |
|
|
type LWarnDecl name = Located (WarnDecl name) |
|
Annotations
|
|
data AnnDecl name |
Constructors | | Instances | |
|
|
type LAnnDecl name = Located (AnnDecl name) |
|
data AnnProvenance name |
Constructors | ValueAnnProvenance name | | TypeAnnProvenance name | | ModuleAnnProvenance | |
|
|
|
annProvenanceName_maybe :: AnnProvenance name -> Maybe name |
|
modifyAnnProvenanceNameM :: Monad m => (before -> m after) -> AnnProvenance before -> m (AnnProvenance after) |
|
Grouping
|
|
data HsGroup id |
A HsDecl is categorised into a HsGroup before being
fed to the renamer.
| Constructors | | Instances | |
|
|
emptyRdrGroup :: HsGroup a |
|
emptyRnGroup :: HsGroup a |
|
appendGroups :: HsGroup a -> HsGroup a -> HsGroup a |
|
Produced by Haddock version 2.6.0 |