Safe Haskell | None |
---|---|
Language | Haskell98 |
Support for source code annotation feature of GHC. That is the ANN pragma.
(c) The University of Glasgow 2006 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
- data Annotation = Annotation {}
- type AnnPayload = Serialized
- data AnnTarget name
- = NamedTarget name
- | ModuleTarget Module
- type CoreAnnTarget = AnnTarget Name
- getAnnTargetName_maybe :: AnnTarget name -> Maybe name
- data AnnEnv
- mkAnnEnv :: [Annotation] -> AnnEnv
- extendAnnEnvList :: AnnEnv -> [Annotation] -> AnnEnv
- plusAnnEnv :: AnnEnv -> AnnEnv -> AnnEnv
- emptyAnnEnv :: AnnEnv
- findAnns :: Typeable a => ([Word8] -> a) -> AnnEnv -> CoreAnnTarget -> [a]
- deserializeAnns :: Typeable a => ([Word8] -> a) -> AnnEnv -> UniqFM [a]
Main Annotation data types
data AnnotationSource
Represents an annotation after it has been sufficiently desugared from
it's initial form of AnnDecl
Annotation | |
|
type AnnPayloadSource
= Serialized | The "payload" of an annotation allows recovery of its value at a given type, and can be persisted to an interface file |
An annotation target
NamedTarget name | We are annotating something with a name: a type or identifier |
ModuleTarget Module | We are annotating a particular module |
type CoreAnnTarget = AnnTarget NameSource
The kind of annotation target found in the middle end of the compiler
getAnnTargetName_maybe :: AnnTarget name -> Maybe nameSource
Get the name
of an annotation target if it exists.
AnnEnv for collecting and querying Annotations
A collection of annotations Can't use a type synonym or we hit bug #2412 due to source import
mkAnnEnv :: [Annotation] -> AnnEnvSource
Construct a new annotation environment that contains the list of annotations provided.
extendAnnEnvList :: AnnEnv -> [Annotation] -> AnnEnvSource
Add the given annotation to the environment.
plusAnnEnv :: AnnEnv -> AnnEnv -> AnnEnvSource
Union two annotation environments.
An empty annotation environment.