ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

Language.Haskell.Syntax.Concrete

Description

Bits of concrete syntax (tokens, layout).

Synopsis

- type LHsToken tok p = XRec p (HsToken tok)
- type LHsUniToken tok utok p = XRec p (HsUniToken tok utok)
- data HsToken (tok :: Symbol) = HsTok
- data HsUniToken (tok :: Symbol) (utok :: Symbol)
  - = HsNormalTok
  - | HsUnicodeTok
- data LayoutInfo pass
  - = ExplicitBraces !(LHsToken "{" pass) !(LHsToken "}" pass)
  - | VirtualBraces !Int
  - | NoLayoutInfo

# Documentation

type LHsToken tok p = XRec p (HsToken tok) Source #

type LHsUniToken tok utok p = XRec p (HsUniToken tok utok) Source #

data HsToken (tok :: Symbol) Source #

A token stored in the syntax tree. For example, when parsing a let-expression, we store `HsToken "let"` and `HsToken "in"`. The locations of those tokens can be used to faithfully reproduce (exactprint) the original program text.

Constructors

HsTok |

#### Instances

Instances details

KnownSymbol tok => Data (HsToken tok) Source # |

Instance details

Defined in Language.Haskell.Syntax.Concrete

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsToken tok -> c (HsToken tok) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsToken tok) Source #

toConstr :: HsToken tok -> Constr Source #

dataTypeOf :: HsToken tok -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsToken tok)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsToken tok)) Source #

gmapT :: (forall b. Data b => b -> b) -> HsToken tok -> HsToken tok Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsToken tok -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsToken tok -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsToken tok -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsToken tok -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsToken tok -> m (HsToken tok) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsToken tok -> m (HsToken tok) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsToken tok -> m (HsToken tok) Source #

KnownSymbol tok => Outputable (HsToken tok) Source # |
Instance details Defined in GHC.Hs.Extension Methods ppr :: HsToken tok -> SDoc Source #
type Anno (HsToken tok) Source # |
Instance details Defined in GHC.Hs.Extension type Anno (HsToken tok) = TokenLocation

data HsUniToken (tok :: Symbol) (utok :: Symbol) Source #

With `UnicodeSyntax`, there might be multiple ways to write the same token. For example an arrow could be either `->` or `→`. This choice must be recorded in order to exactprint such tokens, so instead of `HsToken "->"` we introduce `HsUniToken "->" "→"`.

See also `IsUnicodeSyntax` in `GHC.Parser.Annotation`; we do not use here to avoid a dependency.

Constructors

HsNormalTok |
HsUnicodeTok |

#### Instances

Instances details

(KnownSymbol tok, KnownSymbol utok) => Data (HsUniToken tok utok) Source # |

Instance details

Defined in Language.Haskell.Syntax.Concrete

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsUniToken tok utok -> c (HsUniToken tok utok) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsUniToken tok utok) Source #

toConstr :: HsUniToken tok utok -> Constr Source #

dataTypeOf :: HsUniToken tok utok -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsUniToken tok utok)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsUniToken tok utok)) Source #

gmapT :: (forall b. Data b => b -> b) -> HsUniToken tok utok -> HsUniToken tok utok Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsUniToken tok utok -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsUniToken tok utok -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsUniToken tok utok -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsUniToken tok utok -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsUniToken tok utok -> m (HsUniToken tok utok) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsUniToken tok utok -> m (HsUniToken tok utok) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsUniToken tok utok -> m (HsUniToken tok utok) Source #

(KnownSymbol tok, KnownSymbol utok) => Outputable (HsUniToken tok utok) Source # |
Instance details Defined in GHC.Hs.Extension Methods ppr :: HsUniToken tok utok -> SDoc Source #
type Anno (HsUniToken tok utok) Source # |
Instance details Defined in GHC.Hs.Extension type Anno (HsUniToken tok utok) = TokenLocation

data LayoutInfo pass Source #

Layout information for declarations.

Constructors

ExplicitBraces !(LHsToken "{" pass) !(LHsToken "}" pass)

Explicit braces written by the user.

    class C a where { foo :: a; bar :: a }

VirtualBraces

Virtual braces inserted by the layout algorithm.

    class C a where
      foo :: a
      bar :: a

Fields

- !Int

  Layout column (indentation level, begins at 1)

NoLayoutInfo | Empty or compiler-generated blocks do not have layout information associated with them.

#### Instances

Instances details

Typeable p => Data (LayoutInfo (GhcPass p)) Source # |

Instance details

Defined in GHC.Hs.Extension

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LayoutInfo (GhcPass p) -> c (LayoutInfo (GhcPass p)) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LayoutInfo (GhcPass p)) Source #

toConstr :: LayoutInfo (GhcPass p) -> Constr Source #

dataTypeOf :: LayoutInfo (GhcPass p) -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (LayoutInfo (GhcPass p))) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LayoutInfo (GhcPass p))) Source #

gmapT :: (forall b. Data b => b -> b) -> LayoutInfo (GhcPass p) -> LayoutInfo (GhcPass p) Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LayoutInfo (GhcPass p) -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LayoutInfo (GhcPass p) -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> LayoutInfo (GhcPass p) -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LayoutInfo (GhcPass p) -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LayoutInfo (GhcPass p) -> m (LayoutInfo (GhcPass p)) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LayoutInfo (GhcPass p) -> m (LayoutInfo (GhcPass p)) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LayoutInfo (GhcPass p) -> m (LayoutInfo (GhcPass p)) Source #