{-# LANGUAGE DeriveDataTypeable #-}
module GHC.Parser.Annotation (
getAnnotation, getAndRemoveAnnotation,
getAnnotationComments,getAndRemoveAnnotationComments,
ApiAnns(..),
ApiAnnKey,
AnnKeywordId(..),
AnnotationComment(..),
IsUnicodeSyntax(..),
unicodeAnn,
HasE(..),
LRdrName -- Exists for haddocks only
) where
import GHC.Prelude
import GHC.Types.Name.Reader
import GHC.Utils.Outputable
import GHC.Types.SrcLoc
import qualified Data.Map as Map
import Data.Data
{-
Note [Api annotations]
~~~~~~~~~~~~~~~~~~~~~~
Given a parse tree of a Haskell module, how can we reconstruct
the original Haskell source code, retaining all whitespace and
source code comments? We need to track the locations of all
elements from the original source: this includes keywords such as
'let' / 'in' / 'do' etc as well as punctuation such as commas and
braces, and also comments. We collectively refer to this
metadata as the "API annotations".
Rather than annotate the resulting parse tree with these locations
directly (this would be a major change to some fairly core data
structures in GHC), we instead capture locations for these elements in a
structure separate from the parse tree, and returned in the
pm_annotations field of the ParsedModule type.
The full ApiAnns type is
> data ApiAnns =
> ApiAnns
> { apiAnnItems :: Map.Map ApiAnnKey [RealSrcSpan],
> apiAnnEofPos :: Maybe RealSrcSpan,
> apiAnnComments :: Map.Map RealSrcSpan [RealLocated AnnotationComment],
> apiAnnRogueComments :: [RealLocated AnnotationComment]
> }
NON-COMMENT ELEMENTS
Intuitively, every AST element directly contains a bag of keywords
(keywords can show up more than once in a node: a semicolon i.e. newline
can show up multiple times before the next AST element), each of which
needs to be associated with its location in the original source code.
Consequently, the structure that records non-comment elements is logically
a two level map, from the RealSrcSpan of the AST element containing it, to
a map from keywords ('AnnKeyWord') to all locations of the keyword directly
in the AST element:
> type ApiAnnKey = (RealSrcSpan,AnnKeywordId)
>
> Map.Map ApiAnnKey [RealSrcSpan]
So
> let x = 1 in 2 *x
would result in the AST element
L span (HsLet (binds for x = 1) (2 * x))
and the annotations
(span,AnnLet) having the location of the 'let' keyword
(span,AnnEqual) having the location of the '=' sign
(span,AnnIn) having the location of the 'in' keyword
For any given element in the AST, there is only a set number of
keywords that are applicable for it (e.g., you'll never see an
'import' keyword associated with a let-binding.) The set of allowed
keywords is documented in a comment associated with the constructor
of a given AST element, although the ground truth is in GHC.Parser
and GHC.Parser.PostProcess (which actually add the annotations; see #13012).
COMMENT ELEMENTS
Every comment is associated with a *located* AnnotationComment.
We associate comments with the lowest (most specific) AST element
enclosing them:
> Map.Map RealSrcSpan [RealLocated AnnotationComment]
PARSER STATE
There are three fields in PState (the parser state) which play a role
with annotations.
> annotations :: [(ApiAnnKey,[RealSrcSpan])],
> comment_q :: [RealLocated AnnotationComment],
> annotations_comments :: [(RealSrcSpan,[RealLocated AnnotationComment])]
The 'annotations' and 'annotations_comments' fields are simple: they simply
accumulate annotations that will end up in 'ApiAnns' at the end
(after they are passed to Map.fromList).
The 'comment_q' field captures comments as they are seen in the token stream,
so that when they are ready to be allocated via the parser they are
available (at the time we lex a comment, we don't know what the enclosing
AST node of it is, so we can't associate it with a RealSrcSpan in
annotations_comments).
PARSER EMISSION OF ANNOTATIONS
The parser interacts with the lexer using the function
> addAnnotation :: RealSrcSpan -> AnnKeywordId -> RealSrcSpan -> P ()
which takes the AST element RealSrcSpan, the annotation keyword and the
target RealSrcSpan.
This adds the annotation to the `annotations` field of `PState` and
transfers any comments in `comment_q` WHICH ARE ENCLOSED by
the RealSrcSpan of this element to the `annotations_comments`
field. (Comments which are outside of this annotation are deferred
until later. 'allocateComments' in 'Lexer' is responsible for
making sure we only attach comments that actually fit in the 'SrcSpan'.)
The wiki page describing this feature is
https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations
-}
-- ---------------------------------------------------------------------
-- If you update this, update the Note [Api annotations] above
data ApiAnns =
ApiAnns
{ ApiAnns -> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
apiAnnItems :: Map.Map ApiAnnKey [RealSrcSpan],
ApiAnns -> Maybe RealSrcSpan
apiAnnEofPos :: Maybe RealSrcSpan,
ApiAnns -> Map RealSrcSpan [RealLocated AnnotationComment]
apiAnnComments :: Map.Map RealSrcSpan [RealLocated AnnotationComment],
ApiAnns -> [RealLocated AnnotationComment]
apiAnnRogueComments :: [RealLocated AnnotationComment]
}
-- If you update this, update the Note [Api annotations] above
type ApiAnnKey = (RealSrcSpan,AnnKeywordId)
-- | Retrieve a list of annotation 'SrcSpan's based on the 'SrcSpan'
-- of the annotated AST element, and the known type of the annotation.
getAnnotation :: ApiAnns -> RealSrcSpan -> AnnKeywordId -> [RealSrcSpan]
getAnnotation :: ApiAnns -> RealSrcSpan -> AnnKeywordId -> [RealSrcSpan]
getAnnotation ApiAnns
anns RealSrcSpan
span AnnKeywordId
ann =
case (RealSrcSpan, AnnKeywordId)
-> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
-> Maybe [RealSrcSpan]
forall k a. Ord k => k -> Map k a -> Maybe a
External instance of the constraint type forall a b. (Ord a, Ord b) => Ord (a, b)
External instance of the constraint type Ord RealSrcSpan
Instance of class: Ord of the constraint type Ord AnnKeywordId
Map.lookup (RealSrcSpan, AnnKeywordId)
ann_key Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
ann_items of
Maybe [RealSrcSpan]
Nothing -> []
Just [RealSrcSpan]
ss -> [RealSrcSpan]
ss
where ann_items :: Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
ann_items = ApiAnns -> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
apiAnnItems ApiAnns
anns
ann_key :: (RealSrcSpan, AnnKeywordId)
ann_key = (RealSrcSpan
span,AnnKeywordId
ann)
-- | Retrieve a list of annotation 'SrcSpan's based on the 'SrcSpan'
-- of the annotated AST element, and the known type of the annotation.
-- The list is removed from the annotations.
getAndRemoveAnnotation :: ApiAnns -> RealSrcSpan -> AnnKeywordId
-> ([RealSrcSpan],ApiAnns)
getAndRemoveAnnotation :: ApiAnns -> RealSrcSpan -> AnnKeywordId -> ([RealSrcSpan], ApiAnns)
getAndRemoveAnnotation ApiAnns
anns RealSrcSpan
span AnnKeywordId
ann =
case (RealSrcSpan, AnnKeywordId)
-> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
-> Maybe [RealSrcSpan]
forall k a. Ord k => k -> Map k a -> Maybe a
External instance of the constraint type forall a b. (Ord a, Ord b) => Ord (a, b)
External instance of the constraint type Ord RealSrcSpan
Instance of class: Ord of the constraint type Ord AnnKeywordId
Map.lookup (RealSrcSpan, AnnKeywordId)
ann_key Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
ann_items of
Maybe [RealSrcSpan]
Nothing -> ([],ApiAnns
anns)
Just [RealSrcSpan]
ss -> ([RealSrcSpan]
ss,ApiAnns
anns{ apiAnnItems :: Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
apiAnnItems = (RealSrcSpan, AnnKeywordId)
-> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
-> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
forall k a. Ord k => k -> Map k a -> Map k a
External instance of the constraint type forall a b. (Ord a, Ord b) => Ord (a, b)
External instance of the constraint type Ord RealSrcSpan
Instance of class: Ord of the constraint type Ord AnnKeywordId
Map.delete (RealSrcSpan, AnnKeywordId)
ann_key Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
ann_items })
where ann_items :: Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
ann_items = ApiAnns -> Map (RealSrcSpan, AnnKeywordId) [RealSrcSpan]
apiAnnItems ApiAnns
anns
ann_key :: (RealSrcSpan, AnnKeywordId)
ann_key = (RealSrcSpan
span,AnnKeywordId
ann)
-- |Retrieve the comments allocated to the current 'SrcSpan'
--
-- Note: A given 'SrcSpan' may appear in multiple AST elements,
-- beware of duplicates
getAnnotationComments :: ApiAnns -> RealSrcSpan -> [RealLocated AnnotationComment]
getAnnotationComments :: ApiAnns -> RealSrcSpan -> [RealLocated AnnotationComment]
getAnnotationComments ApiAnns
anns RealSrcSpan
span =
case RealSrcSpan
-> Map RealSrcSpan [RealLocated AnnotationComment]
-> Maybe [RealLocated AnnotationComment]
forall k a. Ord k => k -> Map k a -> Maybe a
External instance of the constraint type Ord RealSrcSpan
Map.lookup RealSrcSpan
span (ApiAnns -> Map RealSrcSpan [RealLocated AnnotationComment]
apiAnnComments ApiAnns
anns) of
Just [RealLocated AnnotationComment]
cs -> [RealLocated AnnotationComment]
cs
Maybe [RealLocated AnnotationComment]
Nothing -> []
-- |Retrieve the comments allocated to the current 'SrcSpan', and
-- remove them from the annotations
getAndRemoveAnnotationComments :: ApiAnns -> RealSrcSpan
-> ([RealLocated AnnotationComment],ApiAnns)
getAndRemoveAnnotationComments :: ApiAnns
-> RealSrcSpan -> ([RealLocated AnnotationComment], ApiAnns)
getAndRemoveAnnotationComments ApiAnns
anns RealSrcSpan
span =
case RealSrcSpan
-> Map RealSrcSpan [RealLocated AnnotationComment]
-> Maybe [RealLocated AnnotationComment]
forall k a. Ord k => k -> Map k a -> Maybe a
External instance of the constraint type Ord RealSrcSpan
Map.lookup RealSrcSpan
span Map RealSrcSpan [RealLocated AnnotationComment]
ann_comments of
Just [RealLocated AnnotationComment]
cs -> ([RealLocated AnnotationComment]
cs, ApiAnns
anns{ apiAnnComments :: Map RealSrcSpan [RealLocated AnnotationComment]
apiAnnComments = RealSrcSpan
-> Map RealSrcSpan [RealLocated AnnotationComment]
-> Map RealSrcSpan [RealLocated AnnotationComment]
forall k a. Ord k => k -> Map k a -> Map k a
External instance of the constraint type Ord RealSrcSpan
Map.delete RealSrcSpan
span Map RealSrcSpan [RealLocated AnnotationComment]
ann_comments })
Maybe [RealLocated AnnotationComment]
Nothing -> ([], ApiAnns
anns)
where ann_comments :: Map RealSrcSpan [RealLocated AnnotationComment]
ann_comments = ApiAnns -> Map RealSrcSpan [RealLocated AnnotationComment]
apiAnnComments ApiAnns
anns
-- --------------------------------------------------------------------
-- | API Annotations exist so that tools can perform source to source
-- conversions of Haskell code. They are used to keep track of the
-- various syntactic keywords that are not captured in the existing
-- AST.
--
-- The annotations, together with original source comments are made
-- available in the @'pm_annotations'@ field of @'GHC.ParsedModule'@.
-- Comments are only retained if @'Opt_KeepRawTokenStream'@ is set in
-- @'DynFlags.DynFlags'@ before parsing.
--
-- The wiki page describing this feature is
-- https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations
--
-- Note: in general the names of these are taken from the
-- corresponding token, unless otherwise noted
-- See note [Api annotations] above for details of the usage
data AnnKeywordId
= AnnAnyclass
| AnnAs
| AnnAt
| AnnBang -- ^ '!'
| AnnBackquote -- ^ '`'
| AnnBy
| AnnCase -- ^ case or lambda case
| AnnClass
| AnnClose -- ^ '\#)' or '\#-}' etc
| AnnCloseB -- ^ '|)'
| AnnCloseBU -- ^ '|)', unicode variant
| AnnCloseC -- ^ '}'
| AnnCloseQ -- ^ '|]'
| AnnCloseQU -- ^ '|]', unicode variant
| AnnCloseP -- ^ ')'
| AnnCloseS -- ^ ']'
| AnnColon
| AnnComma -- ^ as a list separator
| AnnCommaTuple -- ^ in a RdrName for a tuple
| AnnDarrow -- ^ '=>'
| AnnDarrowU -- ^ '=>', unicode variant
| AnnData
| AnnDcolon -- ^ '::'
| AnnDcolonU -- ^ '::', unicode variant
| AnnDefault
| AnnDeriving
| AnnDo
| AnnDot -- ^ '.'
| AnnDotdot -- ^ '..'
| AnnElse
| AnnEqual
| AnnExport
| AnnFamily
| AnnForall
| AnnForallU -- ^ Unicode variant
| AnnForeign
| AnnFunId -- ^ for function name in matches where there are
-- multiple equations for the function.
| AnnGroup
| AnnHeader -- ^ for CType
| AnnHiding
| AnnIf
| AnnImport
| AnnIn
| AnnInfix -- ^ 'infix' or 'infixl' or 'infixr'
| AnnInstance
| AnnLam
| AnnLarrow -- ^ '<-'
| AnnLarrowU -- ^ '<-', unicode variant
| AnnLet
| AnnMdo
| AnnMinus -- ^ '-'
| AnnModule
| AnnNewtype
| AnnName -- ^ where a name loses its location in the AST, this carries it
| AnnOf
| AnnOpen -- ^ '(\#' or '{-\# LANGUAGE' etc
| AnnOpenB -- ^ '(|'
| AnnOpenBU -- ^ '(|', unicode variant
| AnnOpenC -- ^ '{'
| AnnOpenE -- ^ '[e|' or '[e||'
| AnnOpenEQ -- ^ '[|'
| AnnOpenEQU -- ^ '[|', unicode variant
| AnnOpenP -- ^ '('
| AnnOpenS -- ^ '['
| AnnDollar -- ^ prefix '$' -- TemplateHaskell
| AnnDollarDollar -- ^ prefix '$$' -- TemplateHaskell
| AnnPackageName
| AnnPattern
| AnnProc
| AnnQualified
| AnnRarrow -- ^ '->'
| AnnRarrowU -- ^ '->', unicode variant
| AnnRec
| AnnRole
| AnnSafe
| AnnSemi -- ^ ';'
| AnnSimpleQuote -- ^ '''
| AnnSignature
| AnnStatic -- ^ 'static'
| AnnStock
| AnnThen
| AnnThIdSplice -- ^ '$'
| AnnThIdTySplice -- ^ '$$'
| AnnThTyQuote -- ^ double '''
| AnnTilde -- ^ '~'
| AnnType
| AnnUnit -- ^ '()' for types
| AnnUsing
| AnnVal -- ^ e.g. INTEGER
| AnnValStr -- ^ String value, will need quotes when output
| AnnVbar -- ^ '|'
| AnnVia -- ^ 'via'
| AnnWhere
| Annlarrowtail -- ^ '-<'
| AnnlarrowtailU -- ^ '-<', unicode variant
| Annrarrowtail -- ^ '->'
| AnnrarrowtailU -- ^ '->', unicode variant
| AnnLarrowtail -- ^ '-<<'
| AnnLarrowtailU -- ^ '-<<', unicode variant
| AnnRarrowtail -- ^ '>>-'
| AnnRarrowtailU -- ^ '>>-', unicode variant
deriving (AnnKeywordId -> AnnKeywordId -> Bool
(AnnKeywordId -> AnnKeywordId -> Bool)
-> (AnnKeywordId -> AnnKeywordId -> Bool) -> Eq AnnKeywordId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnnKeywordId -> AnnKeywordId -> Bool
$c/= :: AnnKeywordId -> AnnKeywordId -> Bool
== :: AnnKeywordId -> AnnKeywordId -> Bool
$c== :: AnnKeywordId -> AnnKeywordId -> Bool
Eq, Eq AnnKeywordId
Eq AnnKeywordId
-> (AnnKeywordId -> AnnKeywordId -> Ordering)
-> (AnnKeywordId -> AnnKeywordId -> Bool)
-> (AnnKeywordId -> AnnKeywordId -> Bool)
-> (AnnKeywordId -> AnnKeywordId -> Bool)
-> (AnnKeywordId -> AnnKeywordId -> Bool)
-> (AnnKeywordId -> AnnKeywordId -> AnnKeywordId)
-> (AnnKeywordId -> AnnKeywordId -> AnnKeywordId)
-> Ord AnnKeywordId
AnnKeywordId -> AnnKeywordId -> Bool
AnnKeywordId -> AnnKeywordId -> Ordering
AnnKeywordId -> AnnKeywordId -> AnnKeywordId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AnnKeywordId -> AnnKeywordId -> AnnKeywordId
$cmin :: AnnKeywordId -> AnnKeywordId -> AnnKeywordId
max :: AnnKeywordId -> AnnKeywordId -> AnnKeywordId
$cmax :: AnnKeywordId -> AnnKeywordId -> AnnKeywordId
>= :: AnnKeywordId -> AnnKeywordId -> Bool
$c>= :: AnnKeywordId -> AnnKeywordId -> Bool
> :: AnnKeywordId -> AnnKeywordId -> Bool
$c> :: AnnKeywordId -> AnnKeywordId -> Bool
<= :: AnnKeywordId -> AnnKeywordId -> Bool
$c<= :: AnnKeywordId -> AnnKeywordId -> Bool
< :: AnnKeywordId -> AnnKeywordId -> Bool
$c< :: AnnKeywordId -> AnnKeywordId -> Bool
compare :: AnnKeywordId -> AnnKeywordId -> Ordering
$ccompare :: AnnKeywordId -> AnnKeywordId -> Ordering
Instance of class: Eq of the constraint type Eq AnnKeywordId
Instance of class: Ord of the constraint type Ord AnnKeywordId
Instance of class: Eq of the constraint type Eq AnnKeywordId
Ord, Typeable AnnKeywordId
DataType
Constr
Typeable AnnKeywordId
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnKeywordId -> c AnnKeywordId)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnKeywordId)
-> (AnnKeywordId -> Constr)
-> (AnnKeywordId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AnnKeywordId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnKeywordId))
-> ((forall b. Data b => b -> b) -> AnnKeywordId -> AnnKeywordId)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r)
-> (forall u. (forall d. Data d => d -> u) -> AnnKeywordId -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> AnnKeywordId -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId)
-> Data AnnKeywordId
AnnKeywordId -> DataType
AnnKeywordId -> Constr
(forall b. Data b => b -> b) -> AnnKeywordId -> AnnKeywordId
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnKeywordId -> c AnnKeywordId
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnKeywordId
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> AnnKeywordId -> u
forall u. (forall d. Data d => d -> u) -> AnnKeywordId -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnKeywordId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnKeywordId -> c AnnKeywordId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AnnKeywordId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnKeywordId)
$cAnnRarrowtailU :: Constr
$cAnnRarrowtail :: Constr
$cAnnLarrowtailU :: Constr
$cAnnLarrowtail :: Constr
$cAnnrarrowtailU :: Constr
$cAnnrarrowtail :: Constr
$cAnnlarrowtailU :: Constr
$cAnnlarrowtail :: Constr
$cAnnWhere :: Constr
$cAnnVia :: Constr
$cAnnVbar :: Constr
$cAnnValStr :: Constr
$cAnnVal :: Constr
$cAnnUsing :: Constr
$cAnnUnit :: Constr
$cAnnType :: Constr
$cAnnTilde :: Constr
$cAnnThTyQuote :: Constr
$cAnnThIdTySplice :: Constr
$cAnnThIdSplice :: Constr
$cAnnThen :: Constr
$cAnnStock :: Constr
$cAnnStatic :: Constr
$cAnnSignature :: Constr
$cAnnSimpleQuote :: Constr
$cAnnSemi :: Constr
$cAnnSafe :: Constr
$cAnnRole :: Constr
$cAnnRec :: Constr
$cAnnRarrowU :: Constr
$cAnnRarrow :: Constr
$cAnnQualified :: Constr
$cAnnProc :: Constr
$cAnnPattern :: Constr
$cAnnPackageName :: Constr
$cAnnDollarDollar :: Constr
$cAnnDollar :: Constr
$cAnnOpenS :: Constr
$cAnnOpenP :: Constr
$cAnnOpenEQU :: Constr
$cAnnOpenEQ :: Constr
$cAnnOpenE :: Constr
$cAnnOpenC :: Constr
$cAnnOpenBU :: Constr
$cAnnOpenB :: Constr
$cAnnOpen :: Constr
$cAnnOf :: Constr
$cAnnName :: Constr
$cAnnNewtype :: Constr
$cAnnModule :: Constr
$cAnnMinus :: Constr
$cAnnMdo :: Constr
$cAnnLet :: Constr
$cAnnLarrowU :: Constr
$cAnnLarrow :: Constr
$cAnnLam :: Constr
$cAnnInstance :: Constr
$cAnnInfix :: Constr
$cAnnIn :: Constr
$cAnnImport :: Constr
$cAnnIf :: Constr
$cAnnHiding :: Constr
$cAnnHeader :: Constr
$cAnnGroup :: Constr
$cAnnFunId :: Constr
$cAnnForeign :: Constr
$cAnnForallU :: Constr
$cAnnForall :: Constr
$cAnnFamily :: Constr
$cAnnExport :: Constr
$cAnnEqual :: Constr
$cAnnElse :: Constr
$cAnnDotdot :: Constr
$cAnnDot :: Constr
$cAnnDo :: Constr
$cAnnDeriving :: Constr
$cAnnDefault :: Constr
$cAnnDcolonU :: Constr
$cAnnDcolon :: Constr
$cAnnData :: Constr
$cAnnDarrowU :: Constr
$cAnnDarrow :: Constr
$cAnnCommaTuple :: Constr
$cAnnComma :: Constr
$cAnnColon :: Constr
$cAnnCloseS :: Constr
$cAnnCloseP :: Constr
$cAnnCloseQU :: Constr
$cAnnCloseQ :: Constr
$cAnnCloseC :: Constr
$cAnnCloseBU :: Constr
$cAnnCloseB :: Constr
$cAnnClose :: Constr
$cAnnClass :: Constr
$cAnnCase :: Constr
$cAnnBy :: Constr
$cAnnBackquote :: Constr
$cAnnBang :: Constr
$cAnnAt :: Constr
$cAnnAs :: Constr
$cAnnAnyclass :: Constr
$tAnnKeywordId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
gmapMp :: (forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
gmapM :: (forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AnnKeywordId -> m AnnKeywordId
gmapQi :: Int -> (forall d. Data d => d -> u) -> AnnKeywordId -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnKeywordId -> u
gmapQ :: (forall d. Data d => d -> u) -> AnnKeywordId -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> AnnKeywordId -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnKeywordId -> r
gmapT :: (forall b. Data b => b -> b) -> AnnKeywordId -> AnnKeywordId
$cgmapT :: (forall b. Data b => b -> b) -> AnnKeywordId -> AnnKeywordId
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnKeywordId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnKeywordId)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c AnnKeywordId)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AnnKeywordId)
dataTypeOf :: AnnKeywordId -> DataType
$cdataTypeOf :: AnnKeywordId -> DataType
toConstr :: AnnKeywordId -> Constr
$ctoConstr :: AnnKeywordId -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnKeywordId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnKeywordId
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnKeywordId -> c AnnKeywordId
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnKeywordId -> c AnnKeywordId
Data, Int -> AnnKeywordId -> ShowS
[AnnKeywordId] -> ShowS
AnnKeywordId -> String
(Int -> AnnKeywordId -> ShowS)
-> (AnnKeywordId -> String)
-> ([AnnKeywordId] -> ShowS)
-> Show AnnKeywordId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnnKeywordId] -> ShowS
$cshowList :: [AnnKeywordId] -> ShowS
show :: AnnKeywordId -> String
$cshow :: AnnKeywordId -> String
showsPrec :: Int -> AnnKeywordId -> ShowS
$cshowsPrec :: Int -> AnnKeywordId -> ShowS
Show)
instance Outputable AnnKeywordId where
ppr :: AnnKeywordId -> SDoc
ppr AnnKeywordId
x = String -> SDoc
text (AnnKeywordId -> String
forall a. Show a => a -> String
Instance of class: Show of the constraint type Show AnnKeywordId
show AnnKeywordId
x)
-- ---------------------------------------------------------------------
data AnnotationComment =
-- Documentation annotations
AnnDocCommentNext String -- ^ something beginning '-- |'
| AnnDocCommentPrev String -- ^ something beginning '-- ^'
| AnnDocCommentNamed String -- ^ something beginning '-- $'
| AnnDocSection Int String -- ^ a section heading
| AnnDocOptions String -- ^ doc options (prune, ignore-exports, etc)
| AnnLineComment String -- ^ comment starting by "--"
| AnnBlockComment String -- ^ comment in {- -}
deriving (AnnotationComment -> AnnotationComment -> Bool
(AnnotationComment -> AnnotationComment -> Bool)
-> (AnnotationComment -> AnnotationComment -> Bool)
-> Eq AnnotationComment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnnotationComment -> AnnotationComment -> Bool
$c/= :: AnnotationComment -> AnnotationComment -> Bool
== :: AnnotationComment -> AnnotationComment -> Bool
$c== :: AnnotationComment -> AnnotationComment -> Bool
External instance of the constraint type Eq Char
External instance of the constraint type Eq Int
External instance of the constraint type Eq Char
External instance of the constraint type forall a. Eq a => Eq [a]
External instance of the constraint type forall a. Eq a => Eq [a]
External instance of the constraint type Eq Char
Eq, Eq AnnotationComment
Eq AnnotationComment
-> (AnnotationComment -> AnnotationComment -> Ordering)
-> (AnnotationComment -> AnnotationComment -> Bool)
-> (AnnotationComment -> AnnotationComment -> Bool)
-> (AnnotationComment -> AnnotationComment -> Bool)
-> (AnnotationComment -> AnnotationComment -> Bool)
-> (AnnotationComment -> AnnotationComment -> AnnotationComment)
-> (AnnotationComment -> AnnotationComment -> AnnotationComment)
-> Ord AnnotationComment
AnnotationComment -> AnnotationComment -> Bool
AnnotationComment -> AnnotationComment -> Ordering
AnnotationComment -> AnnotationComment -> AnnotationComment
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AnnotationComment -> AnnotationComment -> AnnotationComment
$cmin :: AnnotationComment -> AnnotationComment -> AnnotationComment
max :: AnnotationComment -> AnnotationComment -> AnnotationComment
$cmax :: AnnotationComment -> AnnotationComment -> AnnotationComment
>= :: AnnotationComment -> AnnotationComment -> Bool
$c>= :: AnnotationComment -> AnnotationComment -> Bool
> :: AnnotationComment -> AnnotationComment -> Bool
$c> :: AnnotationComment -> AnnotationComment -> Bool
<= :: AnnotationComment -> AnnotationComment -> Bool
$c<= :: AnnotationComment -> AnnotationComment -> Bool
< :: AnnotationComment -> AnnotationComment -> Bool
$c< :: AnnotationComment -> AnnotationComment -> Bool
compare :: AnnotationComment -> AnnotationComment -> Ordering
$ccompare :: AnnotationComment -> AnnotationComment -> Ordering
External instance of the constraint type Ord Char
External instance of the constraint type Ord Int
External instance of the constraint type Ord Char
External instance of the constraint type forall a. Ord a => Ord [a]
External instance of the constraint type forall a. Ord a => Ord [a]
External instance of the constraint type Ord Char
Instance of class: Eq of the constraint type Eq AnnotationComment
Instance of class: Eq of the constraint type Eq AnnotationComment
Ord, Typeable AnnotationComment
DataType
Constr
Typeable AnnotationComment
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> AnnotationComment
-> c AnnotationComment)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnotationComment)
-> (AnnotationComment -> Constr)
-> (AnnotationComment -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AnnotationComment))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnotationComment))
-> ((forall b. Data b => b -> b)
-> AnnotationComment -> AnnotationComment)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r)
-> (forall u.
(forall d. Data d => d -> u) -> AnnotationComment -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> AnnotationComment -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment)
-> Data AnnotationComment
AnnotationComment -> DataType
AnnotationComment -> Constr
(forall b. Data b => b -> b)
-> AnnotationComment -> AnnotationComment
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnotationComment -> c AnnotationComment
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnotationComment
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> AnnotationComment -> u
forall u. (forall d. Data d => d -> u) -> AnnotationComment -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnotationComment
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnotationComment -> c AnnotationComment
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AnnotationComment)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnotationComment)
$cAnnBlockComment :: Constr
$cAnnLineComment :: Constr
$cAnnDocOptions :: Constr
$cAnnDocSection :: Constr
$cAnnDocCommentNamed :: Constr
$cAnnDocCommentPrev :: Constr
$cAnnDocCommentNext :: Constr
$tAnnotationComment :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
gmapMp :: (forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
gmapM :: (forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> AnnotationComment -> m AnnotationComment
gmapQi :: Int -> (forall d. Data d => d -> u) -> AnnotationComment -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> AnnotationComment -> u
gmapQ :: (forall d. Data d => d -> u) -> AnnotationComment -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> AnnotationComment -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AnnotationComment -> r
gmapT :: (forall b. Data b => b -> b)
-> AnnotationComment -> AnnotationComment
$cgmapT :: (forall b. Data b => b -> b)
-> AnnotationComment -> AnnotationComment
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnotationComment)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AnnotationComment)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c AnnotationComment)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AnnotationComment)
dataTypeOf :: AnnotationComment -> DataType
$cdataTypeOf :: AnnotationComment -> DataType
toConstr :: AnnotationComment -> Constr
$ctoConstr :: AnnotationComment -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnotationComment
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AnnotationComment
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnotationComment -> c AnnotationComment
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AnnotationComment -> c AnnotationComment
External instance of the constraint type Data Char
External instance of the constraint type Data Char
External instance of the constraint type forall a. Data a => Data [a]
External instance of the constraint type Data Char
External instance of the constraint type Data Int
External instance of the constraint type Data Char
External instance of the constraint type forall a. Data a => Data [a]
External instance of the constraint type forall a. Data a => Data [a]
External instance of the constraint type Data Char
Data, Int -> AnnotationComment -> ShowS
[AnnotationComment] -> ShowS
AnnotationComment -> String
(Int -> AnnotationComment -> ShowS)
-> (AnnotationComment -> String)
-> ([AnnotationComment] -> ShowS)
-> Show AnnotationComment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnnotationComment] -> ShowS
$cshowList :: [AnnotationComment] -> ShowS
show :: AnnotationComment -> String
$cshow :: AnnotationComment -> String
showsPrec :: Int -> AnnotationComment -> ShowS
$cshowsPrec :: Int -> AnnotationComment -> ShowS
External instance of the constraint type Show Char
External instance of the constraint type Show Int
External instance of the constraint type Show Char
External instance of the constraint type forall a. Show a => Show [a]
External instance of the constraint type forall a. Show a => Show [a]
External instance of the constraint type Show Char
External instance of the constraint type Ord Int
External instance of the constraint type Ord Int
Show)
-- Note: these are based on the Token versions, but the Token type is
-- defined in GHC.Parser.Lexer and bringing it in here would create a loop
instance Outputable AnnotationComment where
ppr :: AnnotationComment -> SDoc
ppr AnnotationComment
x = String -> SDoc
text (AnnotationComment -> String
forall a. Show a => a -> String
Instance of class: Show of the constraint type Show AnnotationComment
show AnnotationComment
x)
-- | - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnOpen',
-- 'ApiAnnotation.AnnClose','ApiAnnotation.AnnComma',
-- 'ApiAnnotation.AnnRarrow'
-- 'ApiAnnotation.AnnTilde'
-- - May have 'ApiAnnotation.AnnComma' when in a list
type LRdrName = Located RdrName
-- | Certain tokens can have alternate representations when unicode syntax is
-- enabled. This flag is attached to those tokens in the lexer so that the
-- original source representation can be reproduced in the corresponding
-- 'ApiAnnotation'
data IsUnicodeSyntax = UnicodeSyntax | NormalSyntax
deriving (IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
(IsUnicodeSyntax -> IsUnicodeSyntax -> Bool)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> Bool)
-> Eq IsUnicodeSyntax
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
$c/= :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
== :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
$c== :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
Eq, Eq IsUnicodeSyntax
Eq IsUnicodeSyntax
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> Ordering)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> Bool)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> Bool)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> Bool)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> Bool)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax)
-> (IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax)
-> Ord IsUnicodeSyntax
IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
IsUnicodeSyntax -> IsUnicodeSyntax -> Ordering
IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax
$cmin :: IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax
max :: IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax
$cmax :: IsUnicodeSyntax -> IsUnicodeSyntax -> IsUnicodeSyntax
>= :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
$c>= :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
> :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
$c> :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
<= :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
$c<= :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
< :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
$c< :: IsUnicodeSyntax -> IsUnicodeSyntax -> Bool
compare :: IsUnicodeSyntax -> IsUnicodeSyntax -> Ordering
$ccompare :: IsUnicodeSyntax -> IsUnicodeSyntax -> Ordering
Instance of class: Eq of the constraint type Eq IsUnicodeSyntax
Instance of class: Ord of the constraint type Ord IsUnicodeSyntax
Instance of class: Eq of the constraint type Eq IsUnicodeSyntax
Ord, Typeable IsUnicodeSyntax
DataType
Constr
Typeable IsUnicodeSyntax
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsUnicodeSyntax -> c IsUnicodeSyntax)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsUnicodeSyntax)
-> (IsUnicodeSyntax -> Constr)
-> (IsUnicodeSyntax -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsUnicodeSyntax))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c IsUnicodeSyntax))
-> ((forall b. Data b => b -> b)
-> IsUnicodeSyntax -> IsUnicodeSyntax)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r)
-> (forall u.
(forall d. Data d => d -> u) -> IsUnicodeSyntax -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> IsUnicodeSyntax -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax)
-> Data IsUnicodeSyntax
IsUnicodeSyntax -> DataType
IsUnicodeSyntax -> Constr
(forall b. Data b => b -> b) -> IsUnicodeSyntax -> IsUnicodeSyntax
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsUnicodeSyntax -> c IsUnicodeSyntax
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsUnicodeSyntax
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> IsUnicodeSyntax -> u
forall u. (forall d. Data d => d -> u) -> IsUnicodeSyntax -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsUnicodeSyntax
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsUnicodeSyntax -> c IsUnicodeSyntax
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsUnicodeSyntax)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c IsUnicodeSyntax)
$cNormalSyntax :: Constr
$cUnicodeSyntax :: Constr
$tIsUnicodeSyntax :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
gmapMp :: (forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
gmapM :: (forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> IsUnicodeSyntax -> m IsUnicodeSyntax
gmapQi :: Int -> (forall d. Data d => d -> u) -> IsUnicodeSyntax -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> IsUnicodeSyntax -> u
gmapQ :: (forall d. Data d => d -> u) -> IsUnicodeSyntax -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IsUnicodeSyntax -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IsUnicodeSyntax -> r
gmapT :: (forall b. Data b => b -> b) -> IsUnicodeSyntax -> IsUnicodeSyntax
$cgmapT :: (forall b. Data b => b -> b) -> IsUnicodeSyntax -> IsUnicodeSyntax
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c IsUnicodeSyntax)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c IsUnicodeSyntax)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IsUnicodeSyntax)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IsUnicodeSyntax)
dataTypeOf :: IsUnicodeSyntax -> DataType
$cdataTypeOf :: IsUnicodeSyntax -> DataType
toConstr :: IsUnicodeSyntax -> Constr
$ctoConstr :: IsUnicodeSyntax -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsUnicodeSyntax
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IsUnicodeSyntax
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsUnicodeSyntax -> c IsUnicodeSyntax
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IsUnicodeSyntax -> c IsUnicodeSyntax
Data, Int -> IsUnicodeSyntax -> ShowS
[IsUnicodeSyntax] -> ShowS
IsUnicodeSyntax -> String
(Int -> IsUnicodeSyntax -> ShowS)
-> (IsUnicodeSyntax -> String)
-> ([IsUnicodeSyntax] -> ShowS)
-> Show IsUnicodeSyntax
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsUnicodeSyntax] -> ShowS
$cshowList :: [IsUnicodeSyntax] -> ShowS
show :: IsUnicodeSyntax -> String
$cshow :: IsUnicodeSyntax -> String
showsPrec :: Int -> IsUnicodeSyntax -> ShowS
$cshowsPrec :: Int -> IsUnicodeSyntax -> ShowS
Show)
-- | Convert a normal annotation into its unicode equivalent one
unicodeAnn :: AnnKeywordId -> AnnKeywordId
unicodeAnn :: AnnKeywordId -> AnnKeywordId
unicodeAnn AnnKeywordId
AnnForall = AnnKeywordId
AnnForallU
unicodeAnn AnnKeywordId
AnnDcolon = AnnKeywordId
AnnDcolonU
unicodeAnn AnnKeywordId
AnnLarrow = AnnKeywordId
AnnLarrowU
unicodeAnn AnnKeywordId
AnnRarrow = AnnKeywordId
AnnRarrowU
unicodeAnn AnnKeywordId
AnnDarrow = AnnKeywordId
AnnDarrowU
unicodeAnn AnnKeywordId
Annlarrowtail = AnnKeywordId
AnnlarrowtailU
unicodeAnn AnnKeywordId
Annrarrowtail = AnnKeywordId
AnnrarrowtailU
unicodeAnn AnnKeywordId
AnnLarrowtail = AnnKeywordId
AnnLarrowtailU
unicodeAnn AnnKeywordId
AnnRarrowtail = AnnKeywordId
AnnRarrowtailU
unicodeAnn AnnKeywordId
AnnOpenB = AnnKeywordId
AnnOpenBU
unicodeAnn AnnKeywordId
AnnCloseB = AnnKeywordId
AnnCloseBU
unicodeAnn AnnKeywordId
AnnOpenEQ = AnnKeywordId
AnnOpenEQU
unicodeAnn AnnKeywordId
AnnCloseQ = AnnKeywordId
AnnCloseQU
unicodeAnn AnnKeywordId
ann = AnnKeywordId
ann
-- | Some template haskell tokens have two variants, one with an `e` the other
-- not:
--
-- > [| or [e|
-- > [|| or [e||
--
-- This type indicates whether the 'e' is present or not.
data HasE = HasE | NoE
deriving (HasE -> HasE -> Bool
(HasE -> HasE -> Bool) -> (HasE -> HasE -> Bool) -> Eq HasE
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HasE -> HasE -> Bool
$c/= :: HasE -> HasE -> Bool
== :: HasE -> HasE -> Bool
$c== :: HasE -> HasE -> Bool
Eq, Eq HasE
Eq HasE
-> (HasE -> HasE -> Ordering)
-> (HasE -> HasE -> Bool)
-> (HasE -> HasE -> Bool)
-> (HasE -> HasE -> Bool)
-> (HasE -> HasE -> Bool)
-> (HasE -> HasE -> HasE)
-> (HasE -> HasE -> HasE)
-> Ord HasE
HasE -> HasE -> Bool
HasE -> HasE -> Ordering
HasE -> HasE -> HasE
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: HasE -> HasE -> HasE
$cmin :: HasE -> HasE -> HasE
max :: HasE -> HasE -> HasE
$cmax :: HasE -> HasE -> HasE
>= :: HasE -> HasE -> Bool
$c>= :: HasE -> HasE -> Bool
> :: HasE -> HasE -> Bool
$c> :: HasE -> HasE -> Bool
<= :: HasE -> HasE -> Bool
$c<= :: HasE -> HasE -> Bool
< :: HasE -> HasE -> Bool
$c< :: HasE -> HasE -> Bool
compare :: HasE -> HasE -> Ordering
$ccompare :: HasE -> HasE -> Ordering
Instance of class: Eq of the constraint type Eq HasE
Instance of class: Ord of the constraint type Ord HasE
Instance of class: Eq of the constraint type Eq HasE
Ord, Typeable HasE
DataType
Constr
Typeable HasE
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasE -> c HasE)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HasE)
-> (HasE -> Constr)
-> (HasE -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HasE))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HasE))
-> ((forall b. Data b => b -> b) -> HasE -> HasE)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r)
-> (forall u. (forall d. Data d => d -> u) -> HasE -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> HasE -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE)
-> Data HasE
HasE -> DataType
HasE -> Constr
(forall b. Data b => b -> b) -> HasE -> HasE
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasE -> c HasE
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HasE
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> HasE -> u
forall u. (forall d. Data d => d -> u) -> HasE -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HasE
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasE -> c HasE
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HasE)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HasE)
$cNoE :: Constr
$cHasE :: Constr
$tHasE :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HasE -> m HasE
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE
gmapMp :: (forall d. Data d => d -> m d) -> HasE -> m HasE
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE
gmapM :: (forall d. Data d => d -> m d) -> HasE -> m HasE
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HasE -> m HasE
gmapQi :: Int -> (forall d. Data d => d -> u) -> HasE -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HasE -> u
gmapQ :: (forall d. Data d => d -> u) -> HasE -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> HasE -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HasE -> r
gmapT :: (forall b. Data b => b -> b) -> HasE -> HasE
$cgmapT :: (forall b. Data b => b -> b) -> HasE -> HasE
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HasE)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HasE)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c HasE)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HasE)
dataTypeOf :: HasE -> DataType
$cdataTypeOf :: HasE -> DataType
toConstr :: HasE -> Constr
$ctoConstr :: HasE -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HasE
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HasE
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasE -> c HasE
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HasE -> c HasE
Data, Int -> HasE -> ShowS
[HasE] -> ShowS
HasE -> String
(Int -> HasE -> ShowS)
-> (HasE -> String) -> ([HasE] -> ShowS) -> Show HasE
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HasE] -> ShowS
$cshowList :: [HasE] -> ShowS
show :: HasE -> String
$cshow :: HasE -> String
showsPrec :: Int -> HasE -> ShowS
$cshowsPrec :: Int -> HasE -> ShowS
Show)