| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Mikan.Syntax.Internal.Pattern
Contents
Synopsis
- newtype PatternEra = PatternEra {}
- type PatVarName = ArgName
- patVarNameToString :: PatVarName -> ShortText
- nameToPatVarName :: Name -> PatVarName
- data PatternInfo = PatternInfo {
- patOrigin :: PatOrigin
- patAsNames :: [Name]
- defaultPatternInfo :: PatternInfo
- data PatOrigin
- data Pattern' x
- = VarP PatternInfo x
- | DotP PatternInfo Term
- | ConP ConHead ConPatternInfo [NamedArg (Pattern' x)]
- | LitP LitPatternInfo Literal
- | ProjP ProjOrigin QName
- | IApplyP PatternInfo Term Term x
- | DefP PatternInfo QName [NamedArg (Pattern' x)]
- | MaskP (Pattern' x)
- type Pattern = Pattern' PatVarName
- varP :: a -> Pattern' a
- dotP :: Term -> Pattern' a
- litP :: Literal -> Pattern' a
- data DBPatVar = DBPatVar {}
- type DeBruijnPattern = Pattern' DBPatVar
- type PatternSubstitution = Substitution' DeBruijnPattern
- type NAPs = [NamedArg DeBruijnPattern]
- namedVarP :: PatVarName -> Named_ Pattern
- namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern
- absurdP :: Int -> DeBruijnPattern
- data LitPatternInfo = LitPatternInfo {
- litPInfo :: !PatternInfo
- litPEra :: !PatternEra
- data ConPatternInfo = ConPatternInfo {
- conPInfo :: PatternInfo
- conPRecord :: Bool
- conPFallThrough :: Bool
- conPType :: Maybe (Arg Type)
- conPLazy :: Bool
- conPEra :: !PatternEra
- noConPatternInfo :: ConPatternInfo
- toConPatternInfo :: ConInfo -> ConPatternInfo
- fromConPatternInfo :: ConPatternInfo -> ConInfo
- class PatternVars a where
- type PatternVarOut a
- patternVars :: a -> [Arg (Either (PatternVarOut a) Term)]
- patternInfo :: Pattern' x -> Maybe PatternInfo
- patternOrigin :: Pattern' x -> Maybe PatOrigin
- absurdPatternName :: PatVarName
- dbPatPerm :: [NamedArg DeBruijnPattern] -> Maybe Permutation
- dbPatPerm' :: Bool -> [NamedArg DeBruijnPattern] -> Maybe Permutation
- patternToElim :: Arg DeBruijnPattern -> Elim
- patternsToElims :: [NamedArg DeBruijnPattern] -> [Elim]
- patternToTerm :: DeBruijnPattern -> Term
- class MapNamedArgPattern a p where
- mapNamedArgPattern :: (NamedArg (Pattern' a) -> NamedArg (Pattern' a)) -> p -> p
- class PatternLike a b where
- foldrPattern :: Monoid m => (Pattern' a -> m -> m) -> b -> m
- traversePatternM :: Monad m => (Pattern' a -> m (Pattern' a)) -> (Pattern' a -> m (Pattern' a)) -> b -> m b
- foldPattern :: (PatternLike a b, Monoid m) => (Pattern' a -> m) -> b -> m
- preTraversePatternM :: (PatternLike a b, Monad m) => (Pattern' a -> m (Pattern' a)) -> b -> m b
- postTraversePatternM :: (PatternLike a b, Monad m) => (Pattern' a -> m (Pattern' a)) -> b -> m b
- class CountPatternVars a where
- countPatternVars :: a -> Int
- class HasDotP a where
- class HasDefP a where
Documentation
newtype PatternEra Source #
PatternEra crudely approximates the splitting order during LHS
checking, in a way that can be used for clause-based evaluation.
Only patterns that may be strict (constructors and literals) are
associated to an era.
Patterns from a later era may have only become available from matching patterns from a previous era, even if the patterns from a previous era appear "to the right" in the clause.
Constructors
| PatternEra | |
Instances
type PatVarName = ArgName Source #
Pattern variables.
nameToPatVarName :: Name -> PatVarName Source #
data PatternInfo Source #
Information common to all internal patterns.
Constructors
| PatternInfo | |
Fields
| |
Instances
Origin of the pattern: what did the user write in this position?
Constructors
| PatOSystem | Pattern inserted by the system |
| PatOSplit | Pattern generated by case split |
| PatOSplitArg ArgName | Argument to pattern generated by case split |
| PatOVar Name | User wrote a variable pattern |
| PatODot | User wrote a dot pattern |
| PatOWild | User wrote a wildcard pattern |
| PatOCon | User wrote a constructor pattern |
| PatORec | User wrote a record pattern |
| PatOLit | User wrote a literal pattern |
| PatOAbsurd | User wrote an absurd pattern |
Instances
| KillRange PatOrigin Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods | |||||
| EmbPrj PatOrigin Source # | |||||
| NFData PatOrigin Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern | |||||
| Generic PatOrigin Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| Show PatOrigin Source # | |||||
| Eq PatOrigin Source # | |||||
| type Rep PatOrigin Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern type Rep PatOrigin = D1 ('MetaData "PatOrigin" "Mikan.Syntax.Internal.Pattern" "Mikan-2.9.0-D5omT6fIG9r7kR9vN7OpU6" 'False) (((C1 ('MetaCons "PatOSystem" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PatOSplit" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PatOSplitArg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ArgName)) :+: (C1 ('MetaCons "PatOVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name)) :+: C1 ('MetaCons "PatODot" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "PatOWild" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PatOCon" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PatORec" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PatOLit" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PatOAbsurd" 'PrefixI 'False) (U1 :: Type -> Type))))) | |||||
Patterns are variables, constructors, or wildcards.
QName is used in ConP rather than Name since
a constructor might come from a particular namespace.
This also meshes well with the fact that values (i.e.
the arguments we are matching with) use QName.
Constructors
| VarP PatternInfo x | x |
| DotP PatternInfo Term | .t |
| ConP ConHead ConPatternInfo [NamedArg (Pattern' x)] |
|
| LitP LitPatternInfo Literal | E.g. |
| ProjP ProjOrigin QName | Projection copattern. Can only appear by itself. |
| IApplyP PatternInfo Term Term x | Path elimination pattern, like |
| DefP PatternInfo QName [NamedArg (Pattern' x)] | Used for HITs, the QName should be the one from primHComp. |
| MaskP (Pattern' x) | Only used during termination checking of clause right-hand
sides: a pattern guarded by
|
Instances
| Reduce DeBruijnPattern Source # | |||||
Defined in Mikan.TypeChecking.Reduce Methods reduce' :: DeBruijnPattern -> ReduceM DeBruijnPattern Source # reduceB' :: DeBruijnPattern -> ReduceM (Blocked DeBruijnPattern) Source # | |||||
| Subst DeBruijnPattern Source # | |||||
Defined in Mikan.TypeChecking.Substitute Associated Types
Methods applySubst :: Substitution' (SubstArg DeBruijnPattern) -> DeBruijnPattern -> DeBruijnPattern Source # | |||||
| Subst Pattern Source # | |||||
Defined in Mikan.TypeChecking.Substitute Associated Types
Methods applySubst :: Substitution' (SubstArg Pattern) -> Pattern -> Pattern Source # | |||||
| Subst SplitPattern Source # | |||||
Defined in Mikan.TypeChecking.Coverage.SplitPattern Associated Types
Methods applySubst :: Substitution' (SubstArg SplitPattern) -> SplitPattern -> SplitPattern Source # | |||||
| Functor Pattern' Source # | |||||
| Foldable Pattern' Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods fold :: Monoid m => Pattern' m -> m # foldMap :: Monoid m => (a -> m) -> Pattern' a -> m # foldMap' :: Monoid m => (a -> m) -> Pattern' a -> m # foldr :: (a -> b -> b) -> b -> Pattern' a -> b # foldr' :: (a -> b -> b) -> b -> Pattern' a -> b # foldl :: (b -> a -> b) -> b -> Pattern' a -> b # foldl' :: (b -> a -> b) -> b -> Pattern' a -> b # foldr1 :: (a -> a -> a) -> Pattern' a -> a # foldl1 :: (a -> a -> a) -> Pattern' a -> a # elem :: Eq a => a -> Pattern' a -> Bool # maximum :: Ord a => Pattern' a -> a # minimum :: Ord a => Pattern' a -> a # | |||||
| Traversable Pattern' Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern | |||||
| MapNamedArgPattern a (NamedArg (Pattern' a)) Source # | Modify the content of Note: the | ||||
| PatternLike a (Pattern' a) Source # | |||||
| DeBruijn (Pattern' a) => TermToPattern Term (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Patterns.Internal | |||||
| IsProjP (Pattern' a) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods isProjP :: Pattern' a -> Maybe (ProjOrigin, AmbiguousQName) Source # | |||||
| Pretty a => Pretty (Pattern' a) Source # | |||||
| NamesIn (Pattern' a) Source # | |||||
Defined in Mikan.Syntax.Internal.Names | |||||
| CountPatternVars (Pattern' x) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods countPatternVars :: Pattern' x -> Int Source # | |||||
| HasDefP (Pattern' a) Source # | |||||
| HasDotP (Pattern' a) Source # | |||||
| PatternVars (Arg (Pattern' a)) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| PatternVars (NamedArg (Pattern' a)) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| KillRange a => KillRange (Pattern' a) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods killRange :: KillRangeT (Pattern' a) Source # | |||||
| PrettyTCM a => PrettyTCM (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Pretty | |||||
| NormaliseProjP (Pattern' x) Source # | |||||
Defined in Mikan.TypeChecking.Records Methods normaliseProjP :: HasConstInfo m => Pattern' x -> m (Pattern' x) Source # | |||||
| InstantiateFull a => InstantiateFull (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Reduce | |||||
| Normalise a => Normalise (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Reduce | |||||
| IsFlexiblePattern (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Rules.LHS Methods maybeFlexiblePattern :: forall (m :: Type -> Type). HasConstInfo m => Pattern' a -> MaybeT m FlexibleVarKind Source # isFlexiblePattern :: HasConstInfo m => Pattern' a -> m Bool Source # | |||||
| EmbPrj a => EmbPrj (Pattern' a) Source # | |||||
| Apply [NamedArg (Pattern' a)] Source # | Make sure we only drop variable patterns. | ||||
| DeBruijn a => DeBruijn (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Substitute | |||||
| DeBruijn a => IApplyVars (Pattern' a) Source # | |||||
Defined in Mikan.TypeChecking.Telescope.Path Methods iApplyVars :: Pattern' a -> [Int] Source # | |||||
| NFData x => NFData (Pattern' x) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern | |||||
| Generic (Pattern' x) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| Show x => Show (Pattern' x) Source # | |||||
| Eq a => Eq (Pattern' a) Source # | |||||
| type SubstArg DeBruijnPattern Source # | |||||
Defined in Mikan.TypeChecking.Substitute | |||||
| type SubstArg Pattern Source # | |||||
Defined in Mikan.TypeChecking.Substitute | |||||
| type SubstArg SplitPattern Source # | |||||
Defined in Mikan.TypeChecking.Coverage.SplitPattern | |||||
| type PatternVarOut (Arg (Pattern' a)) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern | |||||
| type PatternVarOut (NamedArg (Pattern' a)) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern | |||||
| type Rep (Pattern' x) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern type Rep (Pattern' x) = D1 ('MetaData "Pattern'" "Mikan.Syntax.Internal.Pattern" "Mikan-2.9.0-D5omT6fIG9r7kR9vN7OpU6" 'False) (((C1 ('MetaCons "VarP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PatternInfo) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 x)) :+: C1 ('MetaCons "DotP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PatternInfo) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Term))) :+: (C1 ('MetaCons "ConP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConHead) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConPatternInfo) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [NamedArg (Pattern' x)]))) :+: C1 ('MetaCons "LitP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LitPatternInfo) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Literal)))) :+: ((C1 ('MetaCons "ProjP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProjOrigin) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName)) :+: C1 ('MetaCons "IApplyP" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PatternInfo) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Term)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Term) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 x)))) :+: (C1 ('MetaCons "DefP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PatternInfo) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [NamedArg (Pattern' x)]))) :+: C1 ('MetaCons "MaskP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern' x)))))) | |||||
Arguments
| = Pattern' PatVarName | The |
Type used when numbering pattern variables.
Constructors
| DBPatVar | |
Fields
| |
Instances
| Pretty DBPatVar Source # | |||||
| KillRange DBPatVar Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods | |||||
| PrettyTCM DBPatVar Source # | |||||
Defined in Mikan.TypeChecking.Pretty | |||||
| InstantiateFull DBPatVar Source # | |||||
Defined in Mikan.TypeChecking.Reduce | |||||
| Normalise DBPatVar Source # | |||||
Defined in Mikan.TypeChecking.Reduce | |||||
| Reduce DeBruijnPattern Source # | |||||
Defined in Mikan.TypeChecking.Reduce Methods reduce' :: DeBruijnPattern -> ReduceM DeBruijnPattern Source # reduceB' :: DeBruijnPattern -> ReduceM (Blocked DeBruijnPattern) Source # | |||||
| EmbPrj DBPatVar Source # | |||||
| Subst DeBruijnPattern Source # | |||||
Defined in Mikan.TypeChecking.Substitute Associated Types
Methods applySubst :: Substitution' (SubstArg DeBruijnPattern) -> DeBruijnPattern -> DeBruijnPattern Source # | |||||
| DeBruijn DBPatVar Source # | |||||
Defined in Mikan.TypeChecking.Substitute.DeBruijn | |||||
| NFData DBPatVar Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern | |||||
| Generic DBPatVar Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| Show DBPatVar Source # | |||||
| Eq DBPatVar Source # | |||||
| type SubstArg DeBruijnPattern Source # | |||||
Defined in Mikan.TypeChecking.Substitute | |||||
| type Rep DBPatVar Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern type Rep DBPatVar = D1 ('MetaData "DBPatVar" "Mikan.Syntax.Internal.Pattern" "Mikan-2.9.0-D5omT6fIG9r7kR9vN7OpU6" 'False) (C1 ('MetaCons "DBPatVar" 'PrefixI 'True) (S1 ('MetaSel ('Just "dbPatVarName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PatVarName) :*: S1 ('MetaSel ('Just "dbPatVarIndex") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) | |||||
type DeBruijnPattern = Pattern' DBPatVar Source #
type NAPs = [NamedArg DeBruijnPattern] Source #
Named pattern arguments.
namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern Source #
absurdP :: Int -> DeBruijnPattern Source #
Make an absurd pattern with the given de Bruijn index.
data LitPatternInfo Source #
Information about a literal pattern.
Constructors
| LitPatternInfo | |
Fields
| |
Instances
| KillRange LitPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods | |||||
| EmbPrj LitPatternInfo Source # | |||||
| NFData LitPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods rnf :: LitPatternInfo -> () # | |||||
| Generic LitPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
Methods from :: LitPatternInfo -> Rep LitPatternInfo x # to :: Rep LitPatternInfo x -> LitPatternInfo # | |||||
| Show LitPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods showsPrec :: Int -> LitPatternInfo -> ShowS # show :: LitPatternInfo -> String # showList :: [LitPatternInfo] -> ShowS # | |||||
| type Rep LitPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern type Rep LitPatternInfo = D1 ('MetaData "LitPatternInfo" "Mikan.Syntax.Internal.Pattern" "Mikan-2.9.0-D5omT6fIG9r7kR9vN7OpU6" 'False) (C1 ('MetaCons "LitPatternInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "litPInfo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PatternInfo) :*: S1 ('MetaSel ('Just "litPEra") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PatternEra))) | |||||
data ConPatternInfo Source #
Information about a constructor pattern.
Constructors
| ConPatternInfo | |
Fields
| |
Instances
| NamesIn ConPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Names Methods namesAndMetasIn' :: Monoid m => (Either QName MetaId -> m) -> ConPatternInfo -> m Source # | |||||
| KillRange ConPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods | |||||
| InstantiateFull ConPatternInfo Source # | |||||
Defined in Mikan.TypeChecking.Reduce Methods instantiateFull' :: ConPatternInfo -> ReduceM ConPatternInfo Source # | |||||
| Normalise ConPatternInfo Source # | |||||
Defined in Mikan.TypeChecking.Reduce Methods normalise' :: ConPatternInfo -> ReduceM ConPatternInfo Source # | |||||
| EmbPrj ConPatternInfo Source # | |||||
| Subst ConPatternInfo Source # | |||||
Defined in Mikan.TypeChecking.Substitute Associated Types
Methods applySubst :: Substitution' (SubstArg ConPatternInfo) -> ConPatternInfo -> ConPatternInfo Source # | |||||
| NFData ConPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods rnf :: ConPatternInfo -> () # | |||||
| Generic ConPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
Methods from :: ConPatternInfo -> Rep ConPatternInfo x # to :: Rep ConPatternInfo x -> ConPatternInfo # | |||||
| Show ConPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Methods showsPrec :: Int -> ConPatternInfo -> ShowS # show :: ConPatternInfo -> String # showList :: [ConPatternInfo] -> ShowS # | |||||
| type SubstArg ConPatternInfo Source # | |||||
Defined in Mikan.TypeChecking.Substitute | |||||
| type Rep ConPatternInfo Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern type Rep ConPatternInfo = D1 ('MetaData "ConPatternInfo" "Mikan.Syntax.Internal.Pattern" "Mikan-2.9.0-D5omT6fIG9r7kR9vN7OpU6" 'False) (C1 ('MetaCons "ConPatternInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "conPInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PatternInfo) :*: (S1 ('MetaSel ('Just "conPRecord") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "conPFallThrough") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: (S1 ('MetaSel ('Just "conPType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Arg Type))) :*: (S1 ('MetaSel ('Just "conPLazy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "conPEra") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PatternEra))))) | |||||
toConPatternInfo :: ConInfo -> ConPatternInfo Source #
Build partial ConPatternInfo from ConInfo
fromConPatternInfo :: ConPatternInfo -> ConInfo Source #
Build ConInfo from ConPatternInfo.
class PatternVars a where Source #
Extract pattern variables in left-to-right order.
A DotP is also treated as variable (see docu for Clause).
Associated Types
type PatternVarOut a Source #
Methods
patternVars :: a -> [Arg (Either (PatternVarOut a) Term)] Source #
Instances
| PatternVars (Arg (Pattern' a)) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| PatternVars (NamedArg (Pattern' a)) Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
| |||||
| PatternVars a => PatternVars [a] Source # | |||||
Defined in Mikan.Syntax.Internal.Pattern Associated Types
Methods patternVars :: [a] -> [Arg (Either (PatternVarOut [a]) Term)] Source # | |||||
patternInfo :: Pattern' x -> Maybe PatternInfo Source #
Retrieve the PatternInfo from a pattern
Absurd Lambda
Tools for patterns
dbPatPerm :: [NamedArg DeBruijnPattern] -> Maybe Permutation Source #
dbPatPerm' :: Bool -> [NamedArg DeBruijnPattern] -> Maybe Permutation Source #
Computes the permutation from the clause telescope to the pattern variables.
Use as fromMaybe IMPOSSIBLE . dbPatPerm to crash
in a controlled way if a de Bruijn index is out of scope here.
The first argument controls whether dot patterns counts as variables or not.
patternToElim :: Arg DeBruijnPattern -> Elim Source #
Turn a pattern into a term. Projection patterns are turned into projection eliminations, other patterns into apply elimination.
patternsToElims :: [NamedArg DeBruijnPattern] -> [Elim] Source #
patternToTerm :: DeBruijnPattern -> Term Source #
class MapNamedArgPattern a p where Source #
Minimal complete definition
Nothing
Instances
| MapNamedArgPattern a (NamedArg (Pattern' a)) Source # | Modify the content of Note: the |
| MapNamedArgPattern a p => MapNamedArgPattern a [p] Source # | |
Defined in Mikan.Syntax.Internal.Pattern | |
class PatternLike a b where Source #
Generic pattern traversal.
Pre-applies a pattern modification, recurses, and post-applies another one.
Minimal complete definition
Nothing
Methods
Arguments
| :: Monoid m | |
| => (Pattern' a -> m -> m) | Combine a pattern and the value computed from its subpatterns. |
| -> b | |
| -> m |
Fold pattern.
default foldrPattern :: forall m (f :: Type -> Type) p. (Monoid m, Foldable f, PatternLike a p, f p ~ b) => (Pattern' a -> m -> m) -> b -> m Source #
Arguments
| :: Monad m | |
| => (Pattern' a -> m (Pattern' a)) |
|
| -> (Pattern' a -> m (Pattern' a)) |
|
| -> b | |
| -> m b |
Traverse pattern.
default traversePatternM :: forall (f :: Type -> Type) p m. (Traversable f, PatternLike a p, f p ~ b, Monad m) => (Pattern' a -> m (Pattern' a)) -> (Pattern' a -> m (Pattern' a)) -> b -> m b Source #
Instances
| PatternLike a b => PatternLike a (Arg b) Source # | |
| PatternLike a (Pattern' a) Source # | |
| PatternLike a b => PatternLike a [b] Source # | |
Defined in Mikan.Syntax.Internal.Pattern | |
| PatternLike a b => PatternLike a (Named x b) Source # | |
foldPattern :: (PatternLike a b, Monoid m) => (Pattern' a -> m) -> b -> m Source #
Compute from each subpattern a value and collect them all in a monoid.
Arguments
| :: (PatternLike a b, Monad m) | |
| => (Pattern' a -> m (Pattern' a)) |
|
| -> b | |
| -> m b |
Traverse pattern(s) with a modification before the recursive descent.
Arguments
| :: (PatternLike a b, Monad m) | |
| => (Pattern' a -> m (Pattern' a)) |
|
| -> b | |
| -> m b |
Traverse pattern(s) with a modification after the recursive descent.
class CountPatternVars a where Source #
Minimal complete definition
Nothing
Methods
countPatternVars :: a -> Int Source #
default countPatternVars :: forall (f :: Type -> Type) b. (Foldable f, CountPatternVars b, f b ~ a) => a -> Int Source #
Instances
| CountPatternVars a => CountPatternVars (Arg a) Source # | |
Defined in Mikan.Syntax.Internal.Pattern Methods countPatternVars :: Arg a -> Int Source # | |
| CountPatternVars (Pattern' x) Source # | |
Defined in Mikan.Syntax.Internal.Pattern Methods countPatternVars :: Pattern' x -> Int Source # | |
| CountPatternVars a => CountPatternVars [a] Source # | |
Defined in Mikan.Syntax.Internal.Pattern Methods countPatternVars :: [a] -> Int Source # | |
| CountPatternVars a => CountPatternVars (Named x a) Source # | |
Defined in Mikan.Syntax.Internal.Pattern Methods countPatternVars :: Named x a -> Int Source # | |
class HasDotP a where Source #
Minimal complete definition
Nothing
Methods
Check whether any of the patterns in the given thing are DotPs.
class HasDefP a where Source #
Minimal complete definition
Nothing
Methods
Check whether any of the patterns in the given thing are DefPs.