| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
ReWire.Annotation
Synopsis
- data Annote where
- data Provenance
- = FromSource !Span
- | Synthesized !Text ![Span]
- | NoProvenance
- data Span = Span {}
- class Annotation a where
- class Annotated a where
- newtype Blind a = Blind {
- unBlind :: a
- srcAnnote :: FilePath -> (Int, Int) -> (Int, Int) -> Annote
- primSpan :: Annote -> Maybe Span
- annProv :: Annote -> Provenance
- annContext :: Annote -> [Text]
- noAnn :: Annote
- unAnn :: Data d => d -> d
Documentation
The annotation carried by every IR node: its provenance plus any human-readable context breadcrumbs accumulated as it travels through the passes.
Constructors
| Annote !Provenance ![Text] |
Bundled Patterns
| pattern NoAnnote :: Annote | The empty annotation: a node with no known origin. |
| pattern MsgAnnote :: Text -> Annote | A locationless annotation carrying a single explanatory message. Matches the first context message of any annotation. |
Instances
| NFData Annote Source # | |
Defined in ReWire.Annotation | |
| Data Annote Source # | Opaque to SYB: |
Defined in ReWire.Annotation Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Annote -> c Annote # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Annote # toConstr :: Annote -> Constr # dataTypeOf :: Annote -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Annote) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Annote) # gmapT :: (forall b. Data b => b -> b) -> Annote -> Annote # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Annote -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Annote -> r # gmapQ :: (forall d. Data d => d -> u) -> Annote -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Annote -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Annote -> m Annote # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Annote -> m Annote # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Annote -> m Annote # | |
| Show Annote Source # | |
| Eq Annote Source # | |
| Ord Annote Source # | Annotations are metadata about a node, not part of its meaning. Equality, ordering, and hashing are therefore intentionally blind to them: two terms that differ only in source location must still compare equal, or type comparison and term deduplication (which run over annotated IR) would wrongly distinguish them. |
| Hashable Annote Source # | |
Defined in ReWire.Annotation | |
| Annotation Annote Source # | |
| TextShow Annote Source # | |
Defined in ReWire.Annotation | |
data Provenance Source #
Where an annotated node came from. Nodes parsed from user source are
FromSource; nodes a pass invents are Synthesized, recording the pass
name and the source spans of the inputs it was built from (so errors on
generated code can still point back at the user's source).
Constructors
| FromSource !Span | |
| Synthesized !Text ![Span] | |
| NoProvenance |
Instances
A source region: a file together with 1-based (line, column) start and end positions. Carries the full extent of a node (unlike a single point), which is what lets a diagnostic underline the offending text.
Instances
| NFData Span Source # | |||||
Defined in ReWire.Annotation | |||||
| Generic Span Source # | |||||
Defined in ReWire.Annotation Associated Types
| |||||
| Show Span Source # | |||||
| Eq Span Source # | |||||
| Ord Span Source # | |||||
| type Rep Span Source # | |||||
Defined in ReWire.Annotation type Rep Span = D1 ('MetaData "Span" "ReWire.Annotation" "rewire-base-2.8-FlLB0CaWUZ0C08bXxr65qo" 'False) (C1 ('MetaCons "Span" 'PrefixI 'True) (S1 ('MetaSel ('Just "spanFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just "spanStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Int, Int)) :*: S1 ('MetaSel ('Just "spanEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Int, Int))))) | |||||
class Annotation a where Source #
Instances
Display metadata invisible to equality, ordering, and hashing: wrapping
a field in Blind keeps doc lines and tag tables from perturbing dedupe
keys, memo keys, or the optimizer's fixpoint test (the same convention as
Annote itself, for metadata that isn't an annotation).
Instances
| NFData a => NFData (Blind a) Source # | |||||
Defined in ReWire.Annotation | |||||
| Data a => Data (Blind a) Source # | |||||
Defined in ReWire.Annotation Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Blind a -> c (Blind a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Blind a) # toConstr :: Blind a -> Constr # dataTypeOf :: Blind a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Blind a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Blind a)) # gmapT :: (forall b. Data b => b -> b) -> Blind a -> Blind a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Blind a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Blind a -> r # gmapQ :: (forall d. Data d => d -> u) -> Blind a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Blind a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Blind a -> m (Blind a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Blind a -> m (Blind a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Blind a -> m (Blind a) # | |||||
| Generic (Blind a) Source # | |||||
Defined in ReWire.Annotation Associated Types
| |||||
| Show a => Show (Blind a) Source # | |||||
| Eq (Blind a) Source # | |||||
| Ord (Blind a) Source # | |||||
| Hashable (Blind a) Source # | |||||
Defined in ReWire.Annotation | |||||
| Show a => TextShow (Blind a) Source # | |||||
Defined in ReWire.Annotation | |||||
| type Rep (Blind a) Source # | |||||
Defined in ReWire.Annotation | |||||
srcAnnote :: FilePath -> (Int, Int) -> (Int, Int) -> Annote Source #
Build an annotation for an explicit source region: a file with 1-based (line, column) start and end positions.
primSpan :: Annote -> Maybe Span Source #
The source span underlying an annotation, if it has one. Synthesized nodes yield the span of their first input.
annProv :: Annote -> Provenance Source #
annContext :: Annote -> [Text] Source #