ghc-8.0.2: The GHC API

Safe Haskell | None
Language | Haskell2010

PatSyn

Contents

- Main data types
  - Type deconstruction

Synopsis

- data PatSyn
- mkPatSyn :: Name -> Bool -> ([TyVar], [TyBinder], ThetaType) -> ([TyVar], [TyBinder], ThetaType) -> [Type] -> Type -> (Id, Bool) -> Maybe (Id, Bool) -> [FieldLabel] -> PatSyn
- patSynName :: PatSyn -> Name
- patSynArity :: PatSyn -> Arity
- patSynIsInfix :: PatSyn -> Bool
- patSynArgs :: PatSyn -> [Type]
- patSynMatcher :: PatSyn -> (Id, Bool)
- patSynBuilder :: PatSyn -> Maybe (Id, Bool)
- patSynUnivTyBinders :: PatSyn -> [TyBinder]
- patSynExTyVars :: PatSyn -> [TyVar]
- patSynExTyBinders :: PatSyn -> [TyBinder]
- patSynSig :: PatSyn -> ([TyVar], ThetaType, [TyVar], ThetaType, [Type], Type)
- patSynInstArgTys :: PatSyn -> [Type] -> [Type]
- patSynInstResTy :: PatSyn -> [Type] -> Type
- patSynFieldLabels :: PatSyn -> [FieldLabel]
- patSynFieldType :: PatSyn -> FieldLabelString -> Type
- tidyPatSynIds :: (Id -> Id) -> PatSyn -> PatSyn
- pprPatSynType :: PatSyn -> SDoc

# Main data types

data PatSyn Source #

A pattern synonym See Note [Pattern synonym representation] See Note [Pattern synonym signatures]

Instances

Eq PatSyn # |
Methods (==) :: PatSyn -> PatSyn -> Bool # (/=) :: PatSyn -> PatSyn -> Bool #
Data PatSyn # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PatSyn -> c PatSyn Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PatSyn Source # toConstr :: PatSyn -> Constr Source # dataTypeOf :: PatSyn -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c PatSyn) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PatSyn) Source # gmapT :: (forall b. Data b => b -> b) -> PatSyn -> PatSyn Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PatSyn -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PatSyn -> r Source # gmapQ :: (forall d. Data d => d -> u) -> PatSyn -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> PatSyn -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PatSyn -> m PatSyn Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PatSyn -> m PatSyn Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PatSyn -> m PatSyn Source #
Ord PatSyn # |
Methods compare :: PatSyn -> PatSyn -> Ordering # (<) :: PatSyn -> PatSyn -> Bool # (<=) :: PatSyn -> PatSyn -> Bool # (>) :: PatSyn -> PatSyn -> Bool # (>=) :: PatSyn -> PatSyn -> Bool # max :: PatSyn -> PatSyn -> PatSyn # min :: PatSyn -> PatSyn -> PatSyn #
OutputableBndr PatSyn # |
Methods pprBndr :: BindingSite -> PatSyn -> SDoc Source # pprPrefixOcc :: PatSyn -> SDoc Source # pprInfixOcc :: PatSyn -> SDoc Source #
Outputable PatSyn # |
Methods ppr :: PatSyn -> SDoc Source # pprPrec :: Rational -> PatSyn -> SDoc Source #
Uniquable PatSyn # |
Methods getUnique :: PatSyn -> Unique Source #
NamedThing PatSyn # |
Methods getOccName :: PatSyn -> OccName Source # getName :: PatSyn -> Name Source #

mkPatSyn Source #

Arguments

:: Name |
-> Bool | Is the pattern synonym declared infix?
-> ([TyVar], [TyBinder], ThetaType) | Universially-quantified type variables and required dicts
-> ([TyVar], [TyBinder], ThetaType) | Existentially-quantified type variables and provided dicts
-> [Type] | Original arguments
-> Type | Original result type
-> (Id, Bool) | Name of matcher
-> Maybe (Id, Bool) | Name of 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?

patSynArgs :: PatSyn -> [Type] Source #

patSynMatcher :: PatSyn -> (Id, Bool) Source #

patSynBuilder :: PatSyn -> Maybe (Id, Bool) Source #

patSynUnivTyBinders :: PatSyn -> [TyBinder] Source #

patSynExTyVars :: PatSyn -> [TyVar] Source #

patSynExTyBinders :: PatSyn -> [TyBinder] Source #

patSynSig :: PatSyn -> ([TyVar], ThetaType, [TyVar], ThetaType, [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`

tidyPatSynIds :: (Id -> Id) -> PatSyn -> PatSyn Source #

pprPatSynType :: PatSyn -> SDoc Source #

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