HsPat

ghc-8.0.2: The GHC API

Safe Haskell | None
Language | Haskell2010

HsPat

Synopsis

- data Pat id
  - = WildPat (PostTc id Type)
  - | VarPat (Located 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)
  - | LitPat HsLit
  - | NPat (Located (HsOverLit id)) (Maybe (SyntaxExpr id)) (SyntaxExpr id) (PostTc id Type)
  - | NPlusKPat (Located id) (Located (HsOverLit id)) (HsOverLit id) (SyntaxExpr id) (SyntaxExpr id) (PostTc id Type)
  - | SigPatIn (LPat id) (LHsSigWcType 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)
- 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 {
  - hsRecFieldLbl :: Located id
  - hsRecFieldArg :: arg
  - hsRecPun :: Bool
  }
- type LHsRecField' id arg = Located (HsRecField' id arg)
- type HsRecField id arg = HsRecField' (FieldOcc id) arg
- type LHsRecField id arg = Located (HsRecField id arg)
- type HsRecUpdField id = HsRecField' (AmbiguousFieldOcc id) (LHsExpr id)
- type LHsRecUpdField id = Located (HsRecUpdField id)
- hsRecFields :: HsRecFields id arg -> [PostRn id id]
- hsRecFieldSel :: HsRecField name arg -> Located (PostRn name name)
- hsRecFieldId :: HsRecField Id arg -> Located Id
- hsRecFieldsArgs :: HsRecFields id arg -> [arg]
- hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc Id) arg -> Located Id
- hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc Id) arg -> LFieldOcc Id
- hsRecUpdFieldRdr :: HsRecUpdField id -> Located RdrName
- mkPrefixConPat :: DataCon -> [OutPat id] -> [Type] -> OutPat id
- mkCharLitPat :: String -> Char -> OutPat id
- mkNilPat :: Type -> OutPat id
- isUnliftedHsBind :: HsBind id -> Bool
- looksLazyPatBind :: HsBind id -> Bool
- isUnliftedLPat :: LPat id -> Bool
- isBangedLPat :: LPat id -> Bool
- isBangedPatBind :: HsBind id -> Bool
- hsPatNeedsParens :: Pat a -> Bool
- isIrrefutableHsPat :: OutputableBndr id => LPat id -> Bool
- collectEvVarsPats :: [Pat id] -> Bag EvVar
- pprParendLPat :: OutputableBndr name => LPat name -> SDoc
- pprConArgs :: OutputableBndr id => HsConPatDetails id -> SDoc

# Documentation

data Pat id Source #

- `AnnKeywordId` : `AnnBang`

Constructors

WildPat (PostTc id Type) |
VarPat (Located 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` `')'`
LitPat HsLit |
NPat (Located (HsOverLit id)) (Maybe (SyntaxExpr id)) (SyntaxExpr id) (PostTc id Type) |
NPlusKPat (Located id) (Located (HsOverLit id)) (HsOverLit id) (SyntaxExpr id) (SyntaxExpr id) (PostTc id Type) | `AnnKeywordId` : `AnnVal` ``+``
SigPatIn (LPat id) (LHsSigWcType id) | `AnnKeywordId` : `AnnDcolon`
SigPatOut (LPat id) Type |
CoPat HsWrapper (Pat id) Type |

Instances

DataId id => Data (Pat id) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pat id -> c (Pat id) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Pat id) Source # toConstr :: Pat id -> Constr Source # dataTypeOf :: Pat id -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Pat id)) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Pat id)) Source # gmapT :: (forall b. Data b => b -> b) -> Pat id -> Pat id Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pat id -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pat id -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Pat id -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Pat id -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pat id -> m (Pat id) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat id -> m (Pat id) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat id -> m (Pat id) Source #
OutputableBndr name => Outputable (Pat name) # |
Methods ppr :: Pat name -> SDoc Source # pprPrec :: Rational -> Pat name -> SDoc Source #

type InPat id = LPat id Source #

type OutPat id = LPat id Source #

type LPat id = Located (Pat id) Source #

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

hsConPatArgs :: HsConPatDetails id -> [LPat id] Source #

data HsRecFields id arg Source #

Constructors

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

Instances

Functor (HsRecFields id) # |
Methods fmap :: (a -> b) -> HsRecFields id a -> HsRecFields id b Source # (<$) :: a -> HsRecFields id b -> HsRecFields id a Source #
Foldable (HsRecFields id) # |
Methods fold :: Monoid m => HsRecFields id m -> m Source # foldMap :: Monoid m => (a -> m) -> HsRecFields id a -> m Source # foldr :: (a -> b -> b) -> b -> HsRecFields id a -> b Source # foldr' :: (a -> b -> b) -> b -> HsRecFields id a -> b Source # foldl :: (b -> a -> b) -> b -> HsRecFields id a -> b Source # foldl' :: (b -> a -> b) -> b -> HsRecFields id a -> b Source # foldr1 :: (a -> a -> a) -> HsRecFields id a -> a Source # foldl1 :: (a -> a -> a) -> HsRecFields id a -> a Source # toList :: HsRecFields id a -> [a] Source # null :: HsRecFields id a -> Bool Source # length :: HsRecFields id a -> Int Source # elem :: Eq a => a -> HsRecFields id a -> Bool Source # maximum :: Ord a => HsRecFields id a -> a Source # minimum :: Ord a => HsRecFields id a -> a Source # sum :: Num a => HsRecFields id a -> a Source # product :: Num a => HsRecFields id a -> a Source #
Traversable (HsRecFields id) # |
Methods traverse :: Applicative f => (a -> f b) -> HsRecFields id a -> f (HsRecFields id b) Source # sequenceA :: Applicative f => HsRecFields id (f a) -> f (HsRecFields id a) Source # mapM :: Monad m => (a -> m b) -> HsRecFields id a -> m (HsRecFields id b) Source # sequence :: Monad m => HsRecFields id (m a) -> m (HsRecFields id a) Source #
(DataId id, Data arg) => Data (HsRecFields id arg) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsRecFields id arg -> c (HsRecFields id arg) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsRecFields id arg) Source # toConstr :: HsRecFields id arg -> Constr Source # dataTypeOf :: HsRecFields id arg -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (HsRecFields id arg)) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsRecFields id arg)) Source # gmapT :: (forall b. Data b => b -> b) -> HsRecFields id arg -> HsRecFields id arg Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields id arg -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields id arg -> r Source # gmapQ :: (forall d. Data d => d -> u) -> HsRecFields id arg -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecFields id arg -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsRecFields id arg -> m (HsRecFields id arg) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields id arg -> m (HsRecFields id arg) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields id arg -> m (HsRecFields id arg) Source #
Outputable arg => Outputable (HsRecFields id arg) # |
Methods ppr :: HsRecFields id arg -> SDoc Source # pprPrec :: Rational -> HsRecFields id arg -> SDoc Source #

data HsRecField' id arg Source #

- `AnnKeywordId` : `AnnEqual`,

For details on above see note [Api annotations] in ApiAnnotation

Constructors

HsRecField |
Fields hsRecFieldLbl :: Located id hsRecFieldArg :: arg Filled in by renamer when punning hsRecPun :: Bool Note [Punning]

Instances

Functor (HsRecField' id) # |
Methods fmap :: (a -> b) -> HsRecField' id a -> HsRecField' id b Source # (<$) :: a -> HsRecField' id b -> HsRecField' id a Source #
Foldable (HsRecField' id) # |
Methods fold :: Monoid m => HsRecField' id m -> m Source # foldMap :: Monoid m => (a -> m) -> HsRecField' id a -> m Source # foldr :: (a -> b -> b) -> b -> HsRecField' id a -> b Source # foldr' :: (a -> b -> b) -> b -> HsRecField' id a -> b Source # foldl :: (b -> a -> b) -> b -> HsRecField' id a -> b Source # foldl' :: (b -> a -> b) -> b -> HsRecField' id a -> b Source # foldr1 :: (a -> a -> a) -> HsRecField' id a -> a Source # foldl1 :: (a -> a -> a) -> HsRecField' id a -> a Source # toList :: HsRecField' id a -> [a] Source # null :: HsRecField' id a -> Bool Source # length :: HsRecField' id a -> Int Source # elem :: Eq a => a -> HsRecField' id a -> Bool Source # maximum :: Ord a => HsRecField' id a -> a Source # minimum :: Ord a => HsRecField' id a -> a Source # sum :: Num a => HsRecField' id a -> a Source # product :: Num a => HsRecField' id a -> a Source #
Traversable (HsRecField' id) # |
Methods traverse :: Applicative f => (a -> f b) -> HsRecField' id a -> f (HsRecField' id b) Source # sequenceA :: Applicative f => HsRecField' id (f a) -> f (HsRecField' id a) Source # mapM :: Monad m => (a -> m b) -> HsRecField' id a -> m (HsRecField' id b) Source # sequence :: Monad m => HsRecField' id (m a) -> m (HsRecField' id a) Source #
(Data arg, Data id) => Data (HsRecField' id arg) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsRecField' id arg -> c (HsRecField' id arg) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg) Source # toConstr :: HsRecField' id arg -> Constr Source # dataTypeOf :: HsRecField' id arg -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (HsRecField' id arg)) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsRecField' id arg)) Source # gmapT :: (forall b. Data b => b -> b) -> HsRecField' id arg -> HsRecField' id arg Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r Source # gmapQ :: (forall d. Data d => d -> u) -> HsRecField' id arg -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecField' id arg -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsRecField' id arg -> m (HsRecField' id arg) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecField' id arg -> m (HsRecField' id arg) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecField' id arg -> m (HsRecField' id arg) Source #
(Outputable id, Outputable arg) => Outputable (HsRecField' id arg) # |
Methods ppr :: HsRecField' id arg -> SDoc Source # pprPrec :: Rational -> HsRecField' id arg -> SDoc Source #

type LHsRecField' id arg = Located (HsRecField' id arg) Source #

type HsRecField id arg = HsRecField' (FieldOcc id) arg Source #

type LHsRecField id arg = Located (HsRecField id arg) Source #

type HsRecUpdField id = HsRecField' (AmbiguousFieldOcc id) (LHsExpr id) Source #

type LHsRecUpdField id = Located (HsRecUpdField id) Source #

hsRecFields :: HsRecFields id arg -> [PostRn id id] Source #

hsRecFieldSel :: HsRecField name arg -> Located (PostRn name name) Source #

hsRecFieldId :: HsRecField Id arg -> Located Id Source #

hsRecFieldsArgs :: HsRecFields id arg -> [arg] Source #

hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc Id) arg -> Located Id Source #

hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc Id) arg -> LFieldOcc Id Source #

hsRecUpdFieldRdr :: HsRecUpdField id -> Located RdrName Source #

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

mkCharLitPat :: String -> Char -> OutPat id Source #

mkNilPat :: Type -> OutPat id Source #

isUnliftedHsBind :: HsBind id -> Bool Source #

looksLazyPatBind :: HsBind id -> Bool Source #

isUnliftedLPat :: LPat id -> Bool Source #

isBangedLPat :: LPat id -> Bool Source #

isBangedPatBind :: HsBind id -> Bool Source #

hsPatNeedsParens :: Pat a -> Bool Source #

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

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

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

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