Safe Haskell | None |
---|---|
Language | Haskell2010 |
HsPat
Synopsis
- data Pat p
- = WildPat (PostTc p Type)
- | VarPat (Located (IdP p))
- | LazyPat (LPat p)
- | AsPat (Located (IdP p)) (LPat p)
- | ParPat (LPat p)
- | BangPat (LPat p)
- | ListPat [LPat p] (PostTc p Type) (Maybe (PostTc p Type, SyntaxExpr p))
- | TuplePat [LPat p] Boxity [PostTc p Type]
- | SumPat (LPat p) ConTag Arity (PostTc p [Type])
- | PArrPat [LPat p] (PostTc p Type)
- | ConPatIn (Located (IdP p)) (HsConPatDetails p)
- | ConPatOut { }
- | ViewPat (LHsExpr p) (LPat p) (PostTc p Type)
- | SplicePat (HsSplice p)
- | LitPat (HsLit p)
- | NPat (Located (HsOverLit p)) (Maybe (SyntaxExpr p)) (SyntaxExpr p) (PostTc p Type)
- | NPlusKPat (Located (IdP p)) (Located (HsOverLit p)) (HsOverLit p) (SyntaxExpr p) (SyntaxExpr p) (PostTc p Type)
- | SigPatIn (LPat p) (LHsSigWcType p)
- | SigPatOut (LPat p) Type
- | CoPat HsWrapper (Pat p) Type
- type InPat p = LPat p
- type OutPat p = LPat p
- type LPat p = Located (Pat p)
- type HsConPatDetails p = HsConDetails (LPat p) (HsRecFields p (LPat p))
- hsConPatArgs :: HsConPatDetails p -> [LPat p]
- data HsRecFields p arg = HsRecFields {
- rec_flds :: [LHsRecField p arg]
- rec_dotdot :: Maybe Int
- data HsRecField' id arg = HsRecField {
- hsRecFieldLbl :: Located id
- hsRecFieldArg :: arg
- hsRecPun :: Bool
- type LHsRecField' p arg = Located (HsRecField' p arg)
- type HsRecField p arg = HsRecField' (FieldOcc p) arg
- type LHsRecField p arg = Located (HsRecField p arg)
- type HsRecUpdField p = HsRecField' (AmbiguousFieldOcc p) (LHsExpr p)
- type LHsRecUpdField p = Located (HsRecUpdField p)
- hsRecFields :: HsRecFields p arg -> [PostRn p (IdP p)]
- hsRecFieldSel :: HsRecField pass arg -> Located (PostRn pass (IdP pass))
- hsRecFieldId :: HsRecField GhcTc arg -> Located Id
- hsRecFieldsArgs :: HsRecFields p arg -> [arg]
- hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> Located Id
- hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> LFieldOcc GhcTc
- hsRecUpdFieldRdr :: HsRecUpdField p -> Located RdrName
- mkPrefixConPat :: DataCon -> [OutPat p] -> [Type] -> OutPat p
- mkCharLitPat :: SourceTextX p => SourceText -> Char -> OutPat p
- mkNilPat :: Type -> OutPat p
- looksLazyPatBind :: HsBind p -> Bool
- isBangedLPat :: LPat p -> Bool
- hsPatNeedsParens :: Pat a -> Bool
- isIrrefutableHsPat :: (SourceTextX p, OutputableBndrId p) => LPat p -> Bool
- collectEvVarsPats :: [Pat p] -> Bag EvVar
- pprParendLPat :: (SourceTextX pass, OutputableBndrId pass) => LPat pass -> SDoc
- pprConArgs :: (SourceTextX p, OutputableBndrId p) => HsConPatDetails p -> SDoc
Documentation
Pattern
Constructors
WildPat (PostTc p Type) | Wildcard Pattern The sole reason for a type on a WildPat is to support hsPatType :: Pat Id -> Type |
VarPat (Located (IdP p)) | Variable Pattern |
LazyPat (LPat p) | Lazy Pattern
^ - |
AsPat (Located (IdP p)) (LPat p) | As pattern
^ - |
ParPat (LPat p) | Parenthesised pattern
See Note [Parens in HsSyn] in HsExpr
^ - |
BangPat (LPat p) | Bang pattern
^ - |
ListPat [LPat p] (PostTc p Type) (Maybe (PostTc p Type, SyntaxExpr p)) | Syntactic List
|
TuplePat [LPat p] Boxity [PostTc p Type] | Tuple sub-patterns
|
SumPat (LPat p) ConTag Arity (PostTc p [Type]) | Anonymous sum pattern
|
PArrPat [LPat p] (PostTc p Type) |
|
ConPatIn (Located (IdP p)) (HsConPatDetails p) | Constructor Pattern In |
ConPatOut | Constructor Pattern Out |
ViewPat (LHsExpr p) (LPat p) (PostTc p Type) | View Pattern |
SplicePat (HsSplice p) | Splice Pattern (Includes quasi-quotes) |
LitPat (HsLit p) | Literal Pattern Used for *non-overloaded* literal patterns: Int, Int, Char, String, etc. |
NPat (Located (HsOverLit p)) (Maybe (SyntaxExpr p)) (SyntaxExpr p) (PostTc p Type) | Natural Pattern |
NPlusKPat (Located (IdP p)) (Located (HsOverLit p)) (HsOverLit p) (SyntaxExpr p) (SyntaxExpr p) (PostTc p Type) | n+k pattern |
SigPatIn (LPat p) (LHsSigWcType p) | Pattern with a type signature |
SigPatOut (LPat p) Type | Pattern with a type signature |
CoPat HsWrapper (Pat p) Type | Coercion Pattern |
Instances
DataId p => Data (Pat p) # | |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pat p -> c (Pat p) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Pat p) Source # toConstr :: Pat p -> Constr Source # dataTypeOf :: Pat p -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Pat p)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Pat p)) Source # gmapT :: (forall b. Data b => b -> b) -> Pat p -> Pat p Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pat p -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pat p -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Pat p -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Pat p -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pat p -> m (Pat p) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat p -> m (Pat p) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat p -> m (Pat p) Source # | |
(SourceTextX pass, OutputableBndrId pass) => Outputable (Pat pass) # | |
type HsConPatDetails p = HsConDetails (LPat p) (HsRecFields p (LPat p)) Source #
Haskell Constructor Pattern Details
hsConPatArgs :: HsConPatDetails p -> [LPat p] Source #
data HsRecFields p arg Source #
Haskell Record Fields
HsRecFields is used only for patterns and expressions (not data type declarations)
Constructors
HsRecFields | |
Fields
|
Instances
Functor (HsRecFields p) # | |
Methods fmap :: (a -> b) -> HsRecFields p a -> HsRecFields p b Source # (<$) :: a -> HsRecFields p b -> HsRecFields p a Source # | |
Foldable (HsRecFields p) # | |
Methods fold :: Monoid m => HsRecFields p m -> m Source # foldMap :: Monoid m => (a -> m) -> HsRecFields p a -> m Source # foldr :: (a -> b -> b) -> b -> HsRecFields p a -> b Source # foldr' :: (a -> b -> b) -> b -> HsRecFields p a -> b Source # foldl :: (b -> a -> b) -> b -> HsRecFields p a -> b Source # foldl' :: (b -> a -> b) -> b -> HsRecFields p a -> b Source # foldr1 :: (a -> a -> a) -> HsRecFields p a -> a Source # foldl1 :: (a -> a -> a) -> HsRecFields p a -> a Source # toList :: HsRecFields p a -> [a] Source # null :: HsRecFields p a -> Bool Source # length :: HsRecFields p a -> Int Source # elem :: Eq a => a -> HsRecFields p a -> Bool Source # maximum :: Ord a => HsRecFields p a -> a Source # minimum :: Ord a => HsRecFields p a -> a Source # sum :: Num a => HsRecFields p a -> a Source # product :: Num a => HsRecFields p a -> a Source # | |
Traversable (HsRecFields p) # | |
Methods traverse :: Applicative f => (a -> f b) -> HsRecFields p a -> f (HsRecFields p b) Source # sequenceA :: Applicative f => HsRecFields p (f a) -> f (HsRecFields p a) Source # mapM :: Monad m => (a -> m b) -> HsRecFields p a -> m (HsRecFields p b) Source # sequence :: Monad m => HsRecFields p (m a) -> m (HsRecFields p a) Source # | |
(DataId p, Data arg) => Data (HsRecFields p arg) # | |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsRecFields p arg -> c (HsRecFields p arg) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsRecFields p arg) Source # toConstr :: HsRecFields p arg -> Constr Source # dataTypeOf :: HsRecFields p arg -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsRecFields p arg)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsRecFields p arg)) Source # gmapT :: (forall b. Data b => b -> b) -> HsRecFields p arg -> HsRecFields p arg Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields p arg -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsRecFields p arg -> r Source # gmapQ :: (forall d. Data d => d -> u) -> HsRecFields p arg -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecFields p arg -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsRecFields p arg -> m (HsRecFields p arg) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields p arg -> m (HsRecFields p arg) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsRecFields p arg -> m (HsRecFields p arg) Source # | |
Outputable arg => Outputable (HsRecFields p arg) # | |
data HsRecField' id arg Source #
Haskell Record Field
For details on above see note [Api annotations] in ApiAnnotation
Constructors
HsRecField | |
Fields
|
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 id, Data arg) => 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 p, Outputable arg) => Outputable (HsRecField' p arg) # | |
type LHsRecField' p arg = Located (HsRecField' p arg) Source #
Located Haskell Record Field
type HsRecField p arg = HsRecField' (FieldOcc p) arg Source #
Haskell Record Field
type LHsRecField p arg = Located (HsRecField p arg) Source #
Located Haskell Record Field
type HsRecUpdField p = HsRecField' (AmbiguousFieldOcc p) (LHsExpr p) Source #
Haskell Record Update Field
type LHsRecUpdField p = Located (HsRecUpdField p) Source #
Located Haskell Record Update Field
hsRecFields :: HsRecFields p arg -> [PostRn p (IdP p)] Source #
hsRecFieldSel :: HsRecField pass arg -> Located (PostRn pass (IdP pass)) Source #
hsRecFieldId :: HsRecField GhcTc arg -> Located Id Source #
hsRecFieldsArgs :: HsRecFields p arg -> [arg] Source #
hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> Located Id Source #
hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> LFieldOcc GhcTc Source #
hsRecUpdFieldRdr :: HsRecUpdField p -> Located RdrName Source #
mkCharLitPat :: SourceTextX p => SourceText -> Char -> OutPat p Source #
looksLazyPatBind :: HsBind p -> Bool Source #
isBangedLPat :: LPat p -> Bool Source #
hsPatNeedsParens :: Pat a -> Bool Source #
isIrrefutableHsPat :: (SourceTextX p, OutputableBndrId p) => LPat p -> Bool Source #
pprParendLPat :: (SourceTextX pass, OutputableBndrId pass) => LPat pass -> SDoc Source #
pprConArgs :: (SourceTextX p, OutputableBndrId p) => HsConPatDetails p -> SDoc Source #