ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Hs.Pat

Contents

- Orphan instances

Synopsis

- data Pat p
  - = WildPat (XWildPat p)
  - | VarPat (XVarPat p) (LIdP p)
  - | LazyPat (XLazyPat p) (LPat p)
  - | AsPat (XAsPat p) (LIdP p) (LPat p)
  - | ParPat (XParPat p) (LPat p)
  - | BangPat (XBangPat p) (LPat p)
  - | ListPat (XListPat p) [LPat p]
  - | TuplePat (XTuplePat p) [LPat p] Boxity
  - | OrPat (XOrPat p) (NonEmpty (LPat p))
  - | SumPat (XSumPat p) (LPat p) ConTag SumWidth
  - | ConPat {
    - pat_con_ext :: XConPat p
    - pat_con :: XRec p (ConLikeP p)
    - pat_args :: HsConPatDetails p
    }
  - | ViewPat (XViewPat p) (LHsExpr p) (LPat p)
  - | SplicePat (XSplicePat p) (HsUntypedSplice p)
  - | LitPat (XLitPat p) (HsLit p)
  - | NPat (XNPat p) (XRec p (HsOverLit p)) (Maybe (SyntaxExpr p)) (SyntaxExpr p)
  - | NPlusKPat (XNPlusKPat p) (LIdP p) (XRec p (HsOverLit p)) (HsOverLit p) (SyntaxExpr p) (SyntaxExpr p)
  - | SigPat (XSigPat p) (LPat p) (HsPatSigType (NoGhcTc p))
  - | EmbTyPat (XEmbTyPat p) (HsTyPat (NoGhcTc p))
  - | InvisPat (XInvisPat p) (HsTyPat (NoGhcTc p))
  - | XPat !(XXPat p)
- type LPat p = XRec p (Pat p)
- isInvisArgPat :: Pat p -> Bool
- isVisArgPat :: Pat p -> Bool
- data EpAnnSumPat = EpAnnSumPat {
  - sumPatParens :: (EpaLocation, EpaLocation)
  - sumPatVbarsBefore :: [EpToken "|"]
  - sumPatVbarsAfter :: [EpToken "|"]
  }
- data ConPatTc = ConPatTc {
  - cpt_arg_tys :: [Type]
  - cpt_tvs :: [TyVar]
  - cpt_dicts :: [EvVar]
  - cpt_binds :: TcEvBinds
  - cpt_wrap :: HsWrapper
  }
- type family ConLikeP x
- data HsPatExpansion a b = HsPatExpanded a b
- data XXPatGhcTc
  - = CoPat {
    - co_cpt_wrap :: HsWrapper
    - co_pat_inner :: Pat GhcTc
    - co_pat_ty :: Type
    }
  - | ExpansionPat (Pat GhcRn) (Pat GhcTc)
- type HsConPatDetails p = HsConDetails (HsConPatTyArg (NoGhcTc p)) (LPat p) (HsRecFields p (LPat p))
- hsConPatArgs :: UnXRec p => HsConPatDetails p -> [LPat p]
- hsConPatTyArgs :: HsConPatDetails p -> [HsConPatTyArg (NoGhcTc p)]
- data HsConPatTyArg p = HsConPatTyArg !(XConPatTyArg p) (HsTyPat p)
- data HsRecFields p arg = HsRecFields {
  - rec_ext :: !(XHsRecFields p)
  - rec_flds :: [LHsRecField p arg]
  - rec_dotdot :: Maybe (XRec p RecFieldsDotDot)
  }
- data HsFieldBind lhs rhs = HsFieldBind {
  - hfbAnn :: XHsFieldBind lhs
  - hfbLHS :: lhs
  - hfbRHS :: rhs
  - hfbPun :: Bool
  }
- type LHsFieldBind p id arg = XRec p (HsFieldBind id arg)
- type HsRecField p arg = HsFieldBind (LFieldOcc p) arg
- type LHsRecField p arg = XRec p (HsRecField p arg)
- type HsRecUpdField p q = HsFieldBind (LFieldOcc p) (LHsExpr q)
- type LHsRecUpdField p q = XRec p (HsRecUpdField p q)
- newtype RecFieldsDotDot = RecFieldsDotDot {
  - unRecFieldsDotDot :: Int
  }
- hsRecFields :: UnXRec p => HsRecFields p arg -> [IdP p]
- hsRecFieldSel :: UnXRec p => HsRecField p arg -> IdP p
- hsRecFieldId :: HsRecField GhcTc arg -> Id
- hsRecFieldsArgs :: UnXRec p => HsRecFields p arg -> [arg]
- mkPrefixConPat :: DataCon -> [LPat GhcTc] -> [Type] -> LPat GhcTc
- mkCharLitPat :: SourceText -> Char -> LPat GhcTc
- mkNilPat :: Type -> LPat GhcTc
- isSimplePat :: forall (x :: Pass). LPat (GhcPass x) -> Maybe (IdP (GhcPass x))
- isPatSyn :: LPat GhcTc -> Bool
- looksLazyPatBind :: HsBind GhcTc -> Bool
- isBangedLPat :: forall (p :: Pass). LPat (GhcPass p) -> Bool
- gParPat :: forall (p :: Pass). IsPass p => LPat (GhcPass p) -> Pat (GhcPass p)
- patNeedsParens :: forall (p :: Pass). IsPass p => PprPrec -> Pat (GhcPass p) -> Bool
- parenthesizePat :: forall (p :: Pass). IsPass p => PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
- isIrrefutableHsPat :: forall (p :: Pass). IsPass p => Bool -> (ConLikeP (GhcPass p) -> Bool) -> LPat (GhcPass p) -> Bool
- isBoringHsPat :: forall (p :: Pass). OutputableBndrId p => LPat (GhcPass p) -> Bool
- collectEvVarsPat :: Pat GhcTc -> Bag EvVar
- collectEvVarsPats :: [Pat GhcTc] -> Bag EvVar
- pprParendLPat :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LPat (GhcPass p) -> SDoc
- pprConArgs :: forall (p :: Pass). (OutputableBndrId p, Outputable (Anno (IdGhcP p))) => HsConPatDetails (GhcPass p) -> SDoc
- pprLPat :: forall (p :: Pass). OutputableBndrId p => LPat (GhcPass p) -> SDoc

# Documentation

data Pat p Source #

Pattern

Constructors

WildPat (XWildPat p) | Wildcard Pattern, i.e. `_`
VarPat (XVarPat p) (LIdP p) | Variable Pattern, e.g. `x`
LazyPat (XLazyPat p) (LPat p) | Lazy Pattern, e.g. `~x`
AsPat (XAsPat p) (LIdP p) (LPat p) | As pattern, e.g. `x@pat`
ParPat (XParPat p) (LPat p) | Parenthesised pattern, e.g. `(x)`
BangPat (XBangPat p) (LPat p) | Bang pattern, e.g. `!x`
ListPat (XListPat p) [LPat p] | Syntactic List, e.g. `[x]` or `[x,y]`. Note that `[]` and `(x:xs)` patterns are both represented using `ConPat`.
TuplePat | Tuple pattern, e.g. `(x, y)` (boxed tuples) or `(# x, y #)` (requires `-XUnboxedTuples`)

Fields

- (XTuplePat p)

  After typechecking, holds the types of the tuple components

- [LPat p]

  Tuple sub-patterns

- Boxity

OrPat (XOrPat p) (NonEmpty (LPat p)) | Or Pattern, e.g. `(pat_1; ...; pat_n)`. Used by `-XOrPatterns` Since: 9.12.1
SumPat (XSumPat p) (LPat p) ConTag SumWidth | Anonymous sum pattern, e.g. `(# x | #)`. Used by `-XUnboxedSums`
ConPat | Constructor Pattern, e.g. `()`, `[]` or `Nothing`

Fields

- pat_con_ext :: XConPat p
- pat_con :: XRec p (ConLikeP p)
- pat_args :: HsConPatDetails p

ViewPat (XViewPat p) (LHsExpr p) (LPat p) | View Pattern, e.g. `someFun -> pat`. Used by `-XViewPatterns`
SplicePat (XSplicePat p) (HsUntypedSplice p) | Splice Pattern, e.g. `$(pat)`
LitPat (XLitPat p) (HsLit p) | Literal Pattern Used for non-overloaded literal patterns: Int#, Char#, Int, Char, String, etc.
NPat (XNPat p) (XRec p (HsOverLit p)) (Maybe (SyntaxExpr p)) (SyntaxExpr p) | Natural Pattern, used for all overloaded literals, including overloaded Strings with `-XOverloadedStrings`
NPlusKPat (XNPlusKPat p) (LIdP p) (XRec p (HsOverLit p)) (HsOverLit p) (SyntaxExpr p) (SyntaxExpr p) | n+k pattern, e.g. `n+1`, used by `-XNPlusKPatterns`
SigPat (XSigPat p) (LPat p) (HsPatSigType (NoGhcTc p)) | Pattern with a type signature, e.g. `x :: Int`
EmbTyPat (XEmbTyPat p) (HsTyPat (NoGhcTc p)) | Embed the syntax of types into patterns, e.g. `fn (type t) = rhs`. Enabled by `-XExplicitNamespaces` in conjunction with `-XRequiredTypeArguments`.
InvisPat (XInvisPat p) (HsTyPat (NoGhcTc p)) | Type abstraction which brings into scope type variables associated with invisible forall. E.g. `fn @t ... = rhs`. Used by `-XTypeAbstractions`.
XPat !(XXPat p) | TTG Extension point; see Note [Trees That Grow] in Language.Haskell.Syntax.Extension

#### Instances

Instances details

Data (Pat GhcPs) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: Pat GhcPs -> Constr Source #

dataTypeOf :: Pat GhcPs -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> Pat GhcPs -> Pat GhcPs Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pat GhcPs -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pat GhcPs -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pat GhcPs -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pat GhcPs -> m (Pat GhcPs) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat GhcPs -> m (Pat GhcPs) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat GhcPs -> m (Pat GhcPs) Source #

Data (Pat GhcRn) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: Pat GhcRn -> Constr Source #

dataTypeOf :: Pat GhcRn -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> Pat GhcRn -> Pat GhcRn Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pat GhcRn -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pat GhcRn -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pat GhcRn -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pat GhcRn -> m (Pat GhcRn) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat GhcRn -> m (Pat GhcRn) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat GhcRn -> m (Pat GhcRn) Source #

Data (Pat GhcTc) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: Pat GhcTc -> Constr Source #

dataTypeOf :: Pat GhcTc -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> Pat GhcTc -> Pat GhcTc Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pat GhcTc -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pat GhcTc -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pat GhcTc -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pat GhcTc -> m (Pat GhcTc) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat GhcTc -> m (Pat GhcTc) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat GhcTc -> m (Pat GhcTc) Source #

OutputableBndrId p => Outputable (Pat (GhcPass p)) Source # |
Instance details Defined in GHC.Hs.Pat Methods ppr :: Pat (GhcPass p) -> SDoc Source #
type Anno (Pat (GhcPass p)) Source # |
Instance details Defined in GHC.Hs.Pat type Anno (Pat (GhcPass p)) = SrcSpanAnnA
type Anno [LocatedA (Pat (GhcPass p))] Source # |
Instance details Defined in GHC.Hs.Expr type Anno [LocatedA (Pat (GhcPass p))] = EpaLocation

type LPat p = XRec p (Pat p) Source #

isInvisArgPat :: Pat p -> Bool Source #

isVisArgPat :: Pat p -> Bool Source #

data EpAnnSumPat Source #

Constructors

EpAnnSumPat |

Fields

- sumPatParens :: (EpaLocation, EpaLocation)
- sumPatVbarsBefore :: [EpToken "|"]
- sumPatVbarsAfter :: [EpToken "|"]

#### Instances

Instances details

Data EpAnnSumPat Source # |

Instance details

Defined in GHC.Hs.Pat

Methods

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

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

toConstr :: EpAnnSumPat -> Constr Source #

dataTypeOf :: EpAnnSumPat -> DataType Source #

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

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

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

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

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

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

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

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

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

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

NoAnn EpAnnSumPat Source # |
Instance details Defined in GHC.Hs.Pat Methods noAnn :: EpAnnSumPat Source #

data ConPatTc Source #

This is the extension field for ConPat, added after typechecking It adds quite a few extra fields, to support elaboration of pattern matching.

Constructors

ConPatTc |

Fields

- cpt_arg_tys :: [Type]

  The universal arg types 1-1 with the universal tyvars of the constructor/pattern synonym Use (conLikeResTy pat_con cpt_arg_tys) to get the type of the pattern

- cpt_tvs :: [TyVar]

  Existentially bound type variables in correctly-scoped order e.g. [k:* x:k]

- cpt_dicts :: [EvVar]

  Ditto *coercion variables* and *dictionaries* One reason for putting coercion variable here I think is to ensure their kinds are zonked

- cpt_binds :: TcEvBinds

  Bindings involving those dictionaries

- cpt_wrap :: HsWrapper

  Extra wrapper to pass to the matcher Only relevant for pattern-synonyms; ignored for data cons

#### Instances

Instances details

Data ConPatTc Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: ConPatTc -> Constr Source #

dataTypeOf :: ConPatTc -> DataType Source #

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

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

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

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

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

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

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

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

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

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

type family ConLikeP x Source #

#### Instances

Instances details

type ConLikeP GhcPs Source # |
Instance details Defined in GHC.Hs.Pat type ConLikeP GhcPs = RdrName
type ConLikeP GhcRn Source # |
Instance details Defined in GHC.Hs.Pat type ConLikeP GhcRn = Name
type ConLikeP GhcTc Source # |
Instance details Defined in GHC.Hs.Pat type ConLikeP GhcTc = ConLike

data HsPatExpansion a b Source #

Constructors

HsPatExpanded a b |

#### Instances

Instances details

(Data a, Data b) => Data (HsPatExpansion a b) Source # |

Instance details

Defined in GHC.Hs.Pat

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> HsPatExpansion a b -> c (HsPatExpansion a b) Source #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsPatExpansion a b) Source #

toConstr :: HsPatExpansion a b -> Constr Source #

dataTypeOf :: HsPatExpansion a b -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsPatExpansion a b)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsPatExpansion a b)) Source #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> HsPatExpansion a b -> HsPatExpansion a b Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsPatExpansion a b -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsPatExpansion a b -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsPatExpansion a b -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsPatExpansion a b -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsPatExpansion a b -> m (HsPatExpansion a b) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsPatExpansion a b -> m (HsPatExpansion a b) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsPatExpansion a b -> m (HsPatExpansion a b) Source #

(Outputable a, Outputable b) => Outputable (HsPatExpansion a b) Source # |
Instance details Defined in GHC.Hs.Pat Methods ppr :: HsPatExpansion a b -> SDoc Source #

data XXPatGhcTc Source #

Extension constructor for Pat, added after typechecking.

Constructors

CoPat | Coercion Pattern (translation only) During desugaring a (CoPat co pat) turns into a cast with `co` on the scrutinee, followed by a match on `pat`.

Fields

- co_cpt_wrap :: HsWrapper

  Coercion Pattern If co :: t1 ~ t2, p :: t2, then (CoPat co p) :: t1

- co_pat_inner :: Pat GhcTc

  Why not LPat? Ans: existing locn will do

- co_pat_ty :: Type

  Type of whole pattern, t1

ExpansionPat (Pat GhcRn) (Pat GhcTc) | Pattern expansion: original pattern, and desugared pattern, for RebindableSyntax and other overloaded syntax such as OverloadedLists. See Note [Rebindable syntax and XXExprGhcRn].

#### Instances

Instances details

Data XXPatGhcTc Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: XXPatGhcTc -> Constr Source #

dataTypeOf :: XXPatGhcTc -> DataType Source #

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

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

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

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

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

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

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

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

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

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

type HsConPatDetails p = HsConDetails (HsConPatTyArg (NoGhcTc p)) (LPat p) (HsRecFields p (LPat p)) Source #

Haskell Constructor Pattern Details

hsConPatArgs :: UnXRec p => HsConPatDetails p -> [LPat p] Source #

hsConPatTyArgs :: HsConPatDetails p -> [HsConPatTyArg (NoGhcTc p)] Source #

data HsConPatTyArg p Source #

Type argument in a data constructor pattern, e.g. the `@a` in `f (Just @a x) = ...`.

Constructors

HsConPatTyArg !(XConPatTyArg p) (HsTyPat p) |

#### Instances

Instances details

Data (HsConPatTyArg GhcPs) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: HsConPatTyArg GhcPs -> Constr Source #

dataTypeOf :: HsConPatTyArg GhcPs -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> HsConPatTyArg GhcPs -> HsConPatTyArg GhcPs Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsConPatTyArg GhcPs -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsConPatTyArg GhcPs -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsConPatTyArg GhcPs -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcPs -> m (HsConPatTyArg GhcPs) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcPs -> m (HsConPatTyArg GhcPs) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcPs -> m (HsConPatTyArg GhcPs) Source #

Data (HsConPatTyArg GhcRn) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: HsConPatTyArg GhcRn -> Constr Source #

dataTypeOf :: HsConPatTyArg GhcRn -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> HsConPatTyArg GhcRn -> HsConPatTyArg GhcRn Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsConPatTyArg GhcRn -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsConPatTyArg GhcRn -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsConPatTyArg GhcRn -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcRn -> m (HsConPatTyArg GhcRn) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcRn -> m (HsConPatTyArg GhcRn) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcRn -> m (HsConPatTyArg GhcRn) Source #

Data (HsConPatTyArg GhcTc) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

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

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

toConstr :: HsConPatTyArg GhcTc -> Constr Source #

dataTypeOf :: HsConPatTyArg GhcTc -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> HsConPatTyArg GhcTc -> HsConPatTyArg GhcTc Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsConPatTyArg GhcTc -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsConPatTyArg GhcTc -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsConPatTyArg GhcTc -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcTc -> m (HsConPatTyArg GhcTc) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcTc -> m (HsConPatTyArg GhcTc) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsConPatTyArg GhcTc -> m (HsConPatTyArg GhcTc) Source #

Outputable (HsTyPat p) => Outputable (HsConPatTyArg p) Source # |
Instance details Defined in GHC.Hs.Pat Methods ppr :: HsConPatTyArg p -> SDoc Source #

data HsRecFields p arg Source #

Haskell Record Fields

HsRecFields is used only for patterns and expressions (not data type declarations)

Constructors

HsRecFields |

Fields

- rec_ext :: !(XHsRecFields p)
- rec_flds :: [LHsRecField p arg]
- rec_dotdot :: Maybe (XRec p RecFieldsDotDot)

#### Instances

Instances details

Data body => Data (HsRecFields GhcPs body) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsRecFields GhcPs body -> c (HsRecFields GhcPs body) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsRecFields GhcPs body) Source #

toConstr :: HsRecFields GhcPs body -> Constr Source #

dataTypeOf :: HsRecFields GhcPs body -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsRecFields GhcPs body)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsRecFields GhcPs body)) Source #

gmapT :: (forall b. Data b => b -> b) -> HsRecFields GhcPs body -> HsRecFields GhcPs body Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields GhcPs body -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields GhcPs body -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsRecFields GhcPs body -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecFields GhcPs body -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsRecFields GhcPs body -> m (HsRecFields GhcPs body) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields GhcPs body -> m (HsRecFields GhcPs body) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields GhcPs body -> m (HsRecFields GhcPs body) Source #

Data body => Data (HsRecFields GhcRn body) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsRecFields GhcRn body -> c (HsRecFields GhcRn body) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsRecFields GhcRn body) Source #

toConstr :: HsRecFields GhcRn body -> Constr Source #

dataTypeOf :: HsRecFields GhcRn body -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsRecFields GhcRn body)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsRecFields GhcRn body)) Source #

gmapT :: (forall b. Data b => b -> b) -> HsRecFields GhcRn body -> HsRecFields GhcRn body Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields GhcRn body -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields GhcRn body -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsRecFields GhcRn body -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecFields GhcRn body -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsRecFields GhcRn body -> m (HsRecFields GhcRn body) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields GhcRn body -> m (HsRecFields GhcRn body) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields GhcRn body -> m (HsRecFields GhcRn body) Source #

Data body => Data (HsRecFields GhcTc body) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsRecFields GhcTc body -> c (HsRecFields GhcTc body) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsRecFields GhcTc body) Source #

toConstr :: HsRecFields GhcTc body -> Constr Source #

dataTypeOf :: HsRecFields GhcTc body -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsRecFields GhcTc body)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsRecFields GhcTc body)) Source #

gmapT :: (forall b. Data b => b -> b) -> HsRecFields GhcTc body -> HsRecFields GhcTc body Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields GhcTc body -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields GhcTc body -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsRecFields GhcTc body -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecFields GhcTc body -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsRecFields GhcTc body -> m (HsRecFields GhcTc body) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields GhcTc body -> m (HsRecFields GhcTc body) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields GhcTc body -> m (HsRecFields GhcTc body) Source #

(Outputable arg, Outputable (XRec p (HsRecField p arg)), XRec p RecFieldsDotDot ~ LocatedE RecFieldsDotDot) => Outputable (HsRecFields p arg) Source # |
Instance details Defined in GHC.Hs.Pat Methods ppr :: HsRecFields p arg -> SDoc Source #

data HsFieldBind lhs rhs Source #

Haskell Field Binding

Constructors

HsFieldBind |

Fields

- hfbAnn :: XHsFieldBind lhs
- hfbLHS :: lhs
- hfbRHS :: rhs

  Filled in by renamer when punning

- hfbPun :: Bool

  Note [Punning]

#### Instances

Instances details

Functor (HsFieldBind lhs) Source # |
Instance details Defined in Language.Haskell.Syntax.Pat Methods fmap :: (a -> b) -> HsFieldBind lhs a -> HsFieldBind lhs b Source # (<$) :: a -> HsFieldBind lhs b -> HsFieldBind lhs a Source #
Foldable (HsFieldBind lhs) Source # |

Instance details

Defined in Language.Haskell.Syntax.Pat

Methods

fold :: Monoid m => HsFieldBind lhs m -> m Source #

foldMap :: Monoid m => (a -> m) -> HsFieldBind lhs a -> m Source #

foldMap' :: Monoid m => (a -> m) -> HsFieldBind lhs a -> m Source #

foldr :: (a -> b -> b) -> b -> HsFieldBind lhs a -> b Source #

foldr' :: (a -> b -> b) -> b -> HsFieldBind lhs a -> b Source #

foldl :: (b -> a -> b) -> b -> HsFieldBind lhs a -> b Source #

foldl' :: (b -> a -> b) -> b -> HsFieldBind lhs a -> b Source #

foldr1 :: (a -> a -> a) -> HsFieldBind lhs a -> a Source #

foldl1 :: (a -> a -> a) -> HsFieldBind lhs a -> a Source #

toList :: HsFieldBind lhs a -> [a] Source #

null :: HsFieldBind lhs a -> Bool Source #

length :: HsFieldBind lhs a -> Int Source #

elem :: Eq a => a -> HsFieldBind lhs a -> Bool Source #

maximum :: Ord a => HsFieldBind lhs a -> a Source #

minimum :: Ord a => HsFieldBind lhs a -> a Source #

sum :: Num a => HsFieldBind lhs a -> a Source #

product :: Num a => HsFieldBind lhs a -> a Source #

Traversable (HsFieldBind lhs) Source # |

Instance details

Defined in Language.Haskell.Syntax.Pat

Methods

traverse :: Applicative f => (a -> f b) -> HsFieldBind lhs a -> f (HsFieldBind lhs b) Source #

sequenceA :: Applicative f => HsFieldBind lhs (f a) -> f (HsFieldBind lhs a) Source #

mapM :: Monad m => (a -> m b) -> HsFieldBind lhs a -> m (HsFieldBind lhs b) Source #

sequence :: Monad m => HsFieldBind lhs (m a) -> m (HsFieldBind lhs a) Source #

(Data a, Data b) => Data (HsFieldBind a b) Source # |

Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> HsFieldBind a b -> c (HsFieldBind a b) Source #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsFieldBind a b) Source #

toConstr :: HsFieldBind a b -> Constr Source #

dataTypeOf :: HsFieldBind a b -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsFieldBind a b)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsFieldBind a b)) Source #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> HsFieldBind a b -> HsFieldBind a b Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsFieldBind a b -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsFieldBind a b -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> HsFieldBind a b -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HsFieldBind a b -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsFieldBind a b -> m (HsFieldBind a b) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsFieldBind a b -> m (HsFieldBind a b) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsFieldBind a b -> m (HsFieldBind a b) Source #

(Outputable p, OutputableBndr p, Outputable arg) => Outputable (HsFieldBind p arg) Source # |
Instance details Defined in GHC.Hs.Pat Methods ppr :: HsFieldBind p arg -> SDoc Source #
type Anno (HsFieldBind lhs rhs) Source # |
Instance details Defined in GHC.Hs.Pat type Anno (HsFieldBind lhs rhs) = SrcSpanAnnA

type LHsFieldBind p id arg = XRec p (HsFieldBind id arg) Source #

Located Haskell Record Field

type HsRecField p arg = HsFieldBind (LFieldOcc p) arg Source #

Haskell Record Field

type LHsRecField p arg = XRec p (HsRecField p arg) Source #

Located Haskell Record Field

type HsRecUpdField p q = HsFieldBind (LFieldOcc p) (LHsExpr q) Source #

Haskell Record Update Field

type LHsRecUpdField p q = XRec p (HsRecUpdField p q) Source #

Located Haskell Record Update Field

newtype RecFieldsDotDot Source #

Newtype to be able to have a specific XRec instance for the Int in `rec_dotdot`

Constructors

RecFieldsDotDot |

Fields

- unRecFieldsDotDot :: Int

#### Instances

Instances details

Data RecFieldsDotDot Source # |

Instance details

Defined in Language.Haskell.Syntax.Pat

Methods

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

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

toConstr :: RecFieldsDotDot -> Constr Source #

dataTypeOf :: RecFieldsDotDot -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Eq RecFieldsDotDot Source # |
Instance details Defined in Language.Haskell.Syntax.Pat Methods (==) :: RecFieldsDotDot -> RecFieldsDotDot -> Bool Source # (/=) :: RecFieldsDotDot -> RecFieldsDotDot -> Bool Source #
Ord RecFieldsDotDot Source # |

Instance details

Defined in Language.Haskell.Syntax.Pat

Methods

compare :: RecFieldsDotDot -> RecFieldsDotDot -> Ordering Source #

(<) :: RecFieldsDotDot -> RecFieldsDotDot -> Bool Source #

(<=) :: RecFieldsDotDot -> RecFieldsDotDot -> Bool Source #

(>) :: RecFieldsDotDot -> RecFieldsDotDot -> Bool Source #

(>=) :: RecFieldsDotDot -> RecFieldsDotDot -> Bool Source #

max :: RecFieldsDotDot -> RecFieldsDotDot -> RecFieldsDotDot Source #

min :: RecFieldsDotDot -> RecFieldsDotDot -> RecFieldsDotDot Source #

type Anno RecFieldsDotDot Source # |
Instance details Defined in GHC.Hs.Pat type Anno RecFieldsDotDot = EpaLocation

hsRecFields :: UnXRec p => HsRecFields p arg -> [IdP p] Source #

hsRecFieldSel :: UnXRec p => HsRecField p arg -> IdP p Source #

hsRecFieldId :: HsRecField GhcTc arg -> Id Source #

hsRecFieldsArgs :: UnXRec p => HsRecFields p arg -> [arg] Source #

mkPrefixConPat :: DataCon -> [LPat GhcTc] -> [Type] -> LPat GhcTc Source #

mkCharLitPat :: SourceText -> Char -> LPat GhcTc Source #

mkNilPat :: Type -> LPat GhcTc Source #

isSimplePat :: forall (x :: Pass). LPat (GhcPass x) -> Maybe (IdP (GhcPass x)) Source #

Is the pattern any of combination of:

- (pat)
- pat :: Type
- ~pat
- !pat
- x (variable)

isPatSyn :: LPat GhcTc -> Bool Source #

looksLazyPatBind :: HsBind GhcTc -> Bool Source #

isBangedLPat :: forall (p :: Pass). LPat (GhcPass p) -> Bool Source #

gParPat :: forall (p :: Pass). IsPass p => LPat (GhcPass p) -> Pat (GhcPass p) Source #

Parenthesize a pattern without token information

patNeedsParens :: forall (p :: Pass). IsPass p => PprPrec -> Pat (GhcPass p) -> Bool Source #

``patNeedsParens` p pat` returns `True` if the pattern `pat` needs parentheses under precedence `p`.

parenthesizePat :: forall (p :: Pass). IsPass p => PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p) Source #

``parenthesizePat` p pat` checks if ``patNeedsParens` p pat` is true, and if so, surrounds `pat` with a `ParPat`. Otherwise, it simply returns `pat`.

isIrrefutableHsPat Source #

Arguments

:: forall (p :: Pass). IsPass p |
=> Bool | Are we in a `-XStrict` context? See Note [-XStrict and irrefutability]
-> (ConLikeP (GhcPass p) -> Bool) | How to check whether the `ConLike` in a `ConPat` pattern is irrefutable
-> LPat (GhcPass p) | The (located) pattern to check
-> Bool |

`isIrrefutableHsPat p` is true if matching against `p` cannot fail in the sense of falling through to the next pattern. (NB: this is not quite the same as the (silly) defn in 3.17.2 of the Haskell 98 report.)

If isIrrefutableHsPat returns `True`, the pattern is definitely irrefutable.

However, isIrrefutableHsPat returns `False` if it's in doubt. It's a best effort guess with the information we have available:

- we sometimes call `isIrrefutableHsPat` from the renamer, in which case we don't have type information to hand. This means we can't properly handle GADTs, nor the result TyCon of COMPLETE pragmas.
- even when calling `isIrrefutableHsPat` in the typechecker, we don't keep track of any long distance information like the pattern-match checker does.

isBoringHsPat :: forall (p :: Pass). OutputableBndrId p => LPat (GhcPass p) -> Bool Source #

Is this pattern boring from the perspective of pattern-match checking, i.e. introduces no new pieces of long-distance information which could influence pattern-match checking?

See Note [Boring patterns].

collectEvVarsPat :: Pat GhcTc -> Bag EvVar Source #

collectEvVarsPats :: [Pat GhcTc] -> Bag EvVar Source #

pprParendLPat :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LPat (GhcPass p) -> SDoc Source #

pprConArgs :: forall (p :: Pass). (OutputableBndrId p, Outputable (Anno (IdGhcP p))) => HsConPatDetails (GhcPass p) -> SDoc Source #

pprLPat :: forall (p :: Pass). OutputableBndrId p => LPat (GhcPass p) -> SDoc Source #

# Orphan instances

Outputable (HsTyPat p) => Outputable (HsConPatTyArg p) Source # |
Instance details Methods ppr :: HsConPatTyArg p -> SDoc Source #
OutputableBndrId p => Outputable (Pat (GhcPass p)) Source # |
Instance details Methods ppr :: Pat (GhcPass p) -> SDoc Source #
(Outputable p, OutputableBndr p, Outputable arg) => Outputable (HsFieldBind p arg) Source # |
Instance details Methods ppr :: HsFieldBind p arg -> SDoc Source #
(Outputable arg, Outputable (XRec p (HsRecField p arg)), XRec p RecFieldsDotDot ~ LocatedE RecFieldsDotDot) => Outputable (HsRecFields p arg) Source # |
Instance details Methods ppr :: HsRecFields p arg -> SDoc Source #