ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Core.PatSyn

Contents

- Main data types
  - Type deconstruction

Synopsis

- data PatSyn
- type PatSynMatcher = (Name, Type, Bool)
- type PatSynBuilder = Maybe (Name, Type, Bool)
- mkPatSyn :: Name -> Bool -> ([InvisTVBinder], ThetaType) -> ([InvisTVBinder], ThetaType) -> [FRRType] -> Type -> PatSynMatcher -> PatSynBuilder -> [FieldLabel] -> PatSyn
- patSynName :: PatSyn -> Name
- patSynArity :: PatSyn -> Arity
- patSynIsInfix :: PatSyn -> Bool
- patSynResultType :: PatSyn -> Type
- isVanillaPatSyn :: PatSyn -> Bool
- patSynArgs :: PatSyn -> [Type]
- patSynMatcher :: PatSyn -> PatSynMatcher
- patSynBuilder :: PatSyn -> PatSynBuilder
- patSynUnivTyVarBinders :: PatSyn -> [InvisTVBinder]
- patSynExTyVars :: PatSyn -> [TyVar]
- patSynExTyVarBinders :: PatSyn -> [InvisTVBinder]
- patSynSig :: PatSyn -> ([TyVar], ThetaType, [TyVar], ThetaType, [Scaled Type], Type)
- patSynSigBndr :: PatSyn -> ([InvisTVBinder], ThetaType, [InvisTVBinder], ThetaType, [Scaled Type], Type)
- patSynInstArgTys :: PatSyn -> [Type] -> [Type]
- patSynInstResTy :: PatSyn -> [Type] -> Type
- patSynFieldLabels :: PatSyn -> [FieldLabel]
- patSynFieldType :: PatSyn -> FieldLabelString -> Type
- pprPatSynType :: PatSyn -> SDoc

# Main data types

data PatSyn Source #

Pattern Synonym

See Note [Pattern synonym representation] See Note [Pattern synonym signature contexts]

#### Instances

Instances details

NamedThing PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods getOccName :: PatSyn -> OccName Source # getName :: PatSyn -> Name Source #
Uniquable PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods getUnique :: PatSyn -> Unique Source #
Outputable PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods ppr :: PatSyn -> SDoc Source #
OutputableBndr PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods pprBndr :: BindingSite -> PatSyn -> SDoc Source # pprPrefixOcc :: PatSyn -> SDoc Source # pprInfixOcc :: PatSyn -> SDoc Source # bndrIsJoin_maybe :: PatSyn -> JoinPointHood Source #
Data PatSyn Source # |

Instance details

Defined in GHC.Core.PatSyn

Methods

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

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

toConstr :: PatSyn -> Constr #

dataTypeOf :: PatSyn -> DataType #

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

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

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

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

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

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

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

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

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

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

Eq PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods (==) :: PatSyn -> PatSyn -> Bool # (/=) :: PatSyn -> PatSyn -> Bool #

type PatSynMatcher = (Name, Type, Bool) Source #

type PatSynBuilder = Maybe (Name, Type, Bool) Source #

mkPatSyn Source #

Arguments

:: Name |
-> Bool | Is the pattern synonym declared infix?
-> ([InvisTVBinder], ThetaType) | Universally-quantified type variables and required dicts
-> ([InvisTVBinder], ThetaType) | Existentially-quantified type variables and provided dicts
-> [FRRType] | Original arguments
-> Type | Original result type
-> PatSynMatcher | Matcher
-> PatSynBuilder | Builder
-> [FieldLabel] | Names of fields for a record pattern synonym
-> PatSyn |

Build a new pattern synonym

## Type deconstruction

patSynName :: PatSyn -> Name Source #

The `Name` of the `PatSyn`, giving it a unique, rooted identification

patSynArity :: PatSyn -> Arity Source #

Arity of the pattern synonym

patSynIsInfix :: PatSyn -> Bool Source #

Should the `PatSyn` be presented infix?

patSynResultType :: PatSyn -> Type Source #

isVanillaPatSyn :: PatSyn -> Bool Source #

Is this a 'vanilla' pattern synonym (no existentials, no provided constraints)?

patSynArgs :: PatSyn -> [Type] Source #

patSynMatcher :: PatSyn -> PatSynMatcher Source #

patSynBuilder :: PatSyn -> PatSynBuilder Source #

patSynUnivTyVarBinders :: PatSyn -> [InvisTVBinder] Source #

patSynExTyVars :: PatSyn -> [TyVar] Source #

patSynExTyVarBinders :: PatSyn -> [InvisTVBinder] Source #

patSynSig :: PatSyn -> ([TyVar], ThetaType, [TyVar], ThetaType, [Scaled Type], Type) Source #

patSynSigBndr :: PatSyn -> ([InvisTVBinder], ThetaType, [InvisTVBinder], ThetaType, [Scaled Type], Type) Source #

patSynInstArgTys :: PatSyn -> [Type] -> [Type] Source #

patSynInstResTy :: PatSyn -> [Type] -> Type Source #

patSynFieldLabels :: PatSyn -> [FieldLabel] Source #

patSynFieldType :: PatSyn -> FieldLabelString -> Type Source #

Extract the type for any given labelled field of the `DataCon`

pprPatSynType :: PatSyn -> SDoc Source #

Print the type of a pattern synonym. The foralls are printed explicitly