HsPat

ghc-7.10.3: The GHC API

Safe Haskell | None
Language | Haskell2010

HsPat

Synopsis

- data Pat id
  - = WildPat (PostTc id Type)
  - | VarPat id
  - | LazyPat (LPat id)
  - | AsPat (Located id) (LPat id)
  - | ParPat (LPat id)
  - | BangPat (LPat id)
  - | ListPat [LPat id] (PostTc id Type) (Maybe (PostTc id Type, SyntaxExpr id))
  - | TuplePat [LPat id] Boxity [PostTc id Type]
  - | PArrPat [LPat id] (PostTc id Type)
  - | ConPatIn (Located id) (HsConPatDetails id)
  - | ConPatOut {
    - pat_con :: Located ConLike
    - pat_arg_tys :: [Type]
    - pat_tvs :: [TyVar]
    - pat_dicts :: [EvVar]
    - pat_binds :: TcEvBinds
    - pat_args :: HsConPatDetails id
    - pat_wrap :: HsWrapper
    }
  - | ViewPat (LHsExpr id) (LPat id) (PostTc id Type)
  - | SplicePat (HsSplice id)
  - | QuasiQuotePat (HsQuasiQuote id)
  - | LitPat HsLit
  - | NPat (Located (HsOverLit id)) (Maybe (SyntaxExpr id)) (SyntaxExpr id)
  - | NPlusKPat (Located id) (Located (HsOverLit id)) (SyntaxExpr id) (SyntaxExpr id)
  - | SigPatIn (LPat id) (HsWithBndrs id (LHsType id))
  - | SigPatOut (LPat id) Type
  - | CoPat HsWrapper (Pat id) Type
- type InPat id = LPat id
- type OutPat id = LPat id
- type LPat id = Located (Pat id)
- data HsConDetails arg rec
  - = PrefixCon [arg]
  - | RecCon rec
  - | InfixCon arg arg
- type HsConPatDetails id = HsConDetails (LPat id) (HsRecFields id (LPat id))
- hsConPatArgs :: HsConPatDetails id -> [LPat id]
- data HsRecFields id arg = HsRecFields {
  - rec_flds :: [LHsRecField id arg]
  - rec_dotdot :: Maybe Int
  }
- data HsRecField id arg = HsRecField {
  - hsRecFieldId :: Located id
  - hsRecFieldArg :: arg
  - hsRecPun :: Bool
  }
- type LHsRecField id arg = Located (HsRecField id arg)
- hsRecFields :: HsRecFields id arg -> [id]
- mkPrefixConPat :: DataCon -> [OutPat id] -> [Type] -> OutPat id
- mkCharLitPat :: String -> Char -> OutPat id
- mkNilPat :: Type -> OutPat id
- isStrictHsBind :: HsBind id -> Bool
- looksLazyPatBind :: HsBind id -> Bool
- isStrictLPat :: LPat id -> Bool
- hsPatNeedsParens :: Pat a -> Bool
- isIrrefutableHsPat :: OutputableBndr id => LPat id -> Bool
- pprParendLPat :: OutputableBndr name => LPat name -> SDoc
- pprConArgs :: OutputableBndr id => HsConPatDetails id -> SDoc

# Documentation

data Pat id

- `AnnKeywordId` : `AnnBang`

Constructors

WildPat (PostTc id Type) |
VarPat id |
LazyPat (LPat id) | `AnnKeywordId` : `AnnTilde`
AsPat (Located id) (LPat id) | `AnnKeywordId` : `AnnAt`
ParPat (LPat id) | `AnnKeywordId` : `AnnOpen` `'('`, `AnnClose` `')'`
BangPat (LPat id) | `AnnKeywordId` : `AnnBang`
ListPat [LPat id] (PostTc id Type) (Maybe (PostTc id Type, SyntaxExpr id)) | `AnnKeywordId` : `AnnOpen` `'['`, `AnnClose` `']'`
TuplePat [LPat id] Boxity [PostTc id Type] | `AnnKeywordId` : `AnnOpen` `'('` or `'(#'`, `AnnClose` `')'` or `'#)'`
PArrPat [LPat id] (PostTc id Type) | `AnnKeywordId` : `AnnOpen` `'[:'`, `AnnClose` `':]'`
ConPatIn (Located id) (HsConPatDetails id) |
ConPatOut |
Fields pat_con :: Located ConLike pat_arg_tys :: [Type] pat_tvs :: [TyVar] pat_dicts :: [EvVar] pat_binds :: TcEvBinds pat_args :: HsConPatDetails id pat_wrap :: HsWrapper
ViewPat (LHsExpr id) (LPat id) (PostTc id Type) | `AnnKeywordId` : `AnnRarrow`
SplicePat (HsSplice id) | `AnnKeywordId` : `AnnOpen` `'$('` `AnnClose` `')'`
QuasiQuotePat (HsQuasiQuote id) |
LitPat HsLit |
NPat (Located (HsOverLit id)) (Maybe (SyntaxExpr id)) (SyntaxExpr id) |
NPlusKPat (Located id) (Located (HsOverLit id)) (SyntaxExpr id) (SyntaxExpr id) | `AnnKeywordId` : `AnnVal` ``+``
SigPatIn (LPat id) (HsWithBndrs id (LHsType id)) | `AnnKeywordId` : `AnnDcolon`
SigPatOut (LPat id) Type |
CoPat HsWrapper (Pat id) Type |

Instances

DataId id => Data (Pat id) |
OutputableBndr name => Outputable (Pat name) |

type InPat id = LPat id

type OutPat id = LPat id

type LPat id = Located (Pat id)

data HsConDetails arg rec

Constructors

PrefixCon [arg] |
RecCon rec |
InfixCon arg arg |

Instances

(Data arg, Data rec) => Data (HsConDetails arg rec) |

type HsConPatDetails id = HsConDetails (LPat id) (HsRecFields id (LPat id))

hsConPatArgs :: HsConPatDetails id -> [LPat id]

data HsRecFields id arg

Constructors

HsRecFields |
Fields rec_flds :: [LHsRecField id arg] rec_dotdot :: Maybe Int

Instances

(Data id, Data arg) => Data (HsRecFields id arg) |
(OutputableBndr id, Outputable arg) => Outputable (HsRecFields id arg) |

data HsRecField id arg

- `AnnKeywordId` : `AnnEqual`,

Constructors

HsRecField |
Fields hsRecFieldId :: Located id hsRecFieldArg :: arg hsRecPun :: Bool

Instances

(Data id, Data arg) => Data (HsRecField id arg) |
(OutputableBndr id, Outputable arg) => Outputable (HsRecField id arg) |

type LHsRecField id arg = Located (HsRecField id arg)

hsRecFields :: HsRecFields id arg -> [id]

mkPrefixConPat :: DataCon -> [OutPat id] -> [Type] -> OutPat id

mkCharLitPat :: String -> Char -> OutPat id

mkNilPat :: Type -> OutPat id

isStrictHsBind :: HsBind id -> Bool

looksLazyPatBind :: HsBind id -> Bool

isStrictLPat :: LPat id -> Bool

hsPatNeedsParens :: Pat a -> Bool

isIrrefutableHsPat :: OutputableBndr id => LPat id -> Bool

pprParendLPat :: OutputableBndr name => LPat name -> SDoc

pprConArgs :: OutputableBndr id => HsConPatDetails id -> SDoc