Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- clauseArgs :: Clause -> Args
- clauseElims :: Clause -> Elims
- class FunArity a where
- class LabelPatVars a b i | b -> i where
- labelPatVars :: a -> State [i] b
- unlabelPatVars :: b -> a
- numberPatVars :: LabelPatVars a b Int => Int -> Permutation -> a -> b
- unnumberPatVars :: LabelPatVars a b i => b -> a
- dbPatPerm :: [NamedArg DeBruijnPattern] -> Maybe Permutation
- dbPatPerm' :: Bool -> [NamedArg DeBruijnPattern] -> Maybe Permutation
- clausePerm :: Clause -> 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 PatternVarModalities p x | p -> x where
- patternVarModalities :: p -> [(x, Modality)]
Tools for clauses
clauseArgs :: Clause -> Args Source #
Translate the clause patterns to terms with free variables bound by the clause telescope.
Precondition: no projection patterns.
clauseElims :: Clause -> Elims Source #
Translate the clause patterns to an elimination spine with free variables bound by the clause telescope.
class FunArity a where Source #
Arity of a function, computed from clauses.
Tools for patterns
class LabelPatVars a b i | b -> i where Source #
Label the pattern variables from left to right using one label for each variable pattern and one for each dot pattern.
Nothing
labelPatVars :: a -> State [i] b Source #
default labelPatVars :: (Traversable f, LabelPatVars a' b' i, f a' ~ a, f b' ~ b) => a -> State [i] b Source #
unlabelPatVars :: b -> a Source #
Intended, but unpractical due to the absence of type-level lambda, is:
labelPatVars :: f (Pattern' x) -> State [i] (f (Pattern' (i,x)))
default unlabelPatVars :: (Traversable f, LabelPatVars a' b' i, f a' ~ a, f b' ~ b) => b -> a Source #
Instances
LabelPatVars Pattern DeBruijnPattern Int Source # | |
Defined in Agda.Syntax.Internal.Pattern labelPatVars :: Pattern -> State [Int] DeBruijnPattern Source # | |
LabelPatVars a b i => LabelPatVars [a] [b] i Source # | |
Defined in Agda.Syntax.Internal.Pattern labelPatVars :: [a] -> State [i] [b] Source # unlabelPatVars :: [b] -> [a] Source # | |
LabelPatVars a b i => LabelPatVars (Arg a) (Arg b) i Source # | |
Defined in Agda.Syntax.Internal.Pattern | |
LabelPatVars a b i => LabelPatVars (Named x a) (Named x b) i Source # | |
Defined in Agda.Syntax.Internal.Pattern |
numberPatVars :: LabelPatVars a b Int => Int -> Permutation -> a -> b Source #
Augment pattern variables with their de Bruijn index.
unnumberPatVars :: LabelPatVars a b i => b -> a Source #
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.
clausePerm :: Clause -> Maybe Permutation Source #
Computes the permutation from the clause telescope to the pattern variables.
Use as fromMaybe IMPOSSIBLE . clausePerm
to crash
in a controlled way if a de Bruijn index is out of scope here.
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 #
Nothing
mapNamedArgPattern :: (NamedArg (Pattern' a) -> NamedArg (Pattern' a)) -> p -> p Source #
default mapNamedArgPattern :: (Functor f, MapNamedArgPattern a p', p ~ f p') => (NamedArg (Pattern' a) -> NamedArg (Pattern' a)) -> p -> p Source #
Instances
MapNamedArgPattern a p => MapNamedArgPattern a [p] Source # | |
Defined in Agda.Syntax.Internal.Pattern | |
MapNamedArgPattern a (NamedArg (Pattern' a)) Source # | Modify the content of Note: the |
class PatternLike a b where Source #
Generic pattern traversal.
Pre-applies a pattern modification, recurses, and post-applies another one.
Nothing
:: Monoid m | |
=> (Pattern' a -> m -> m) | Combine a pattern and the value computed from its subpatterns. |
-> b | |
-> m |
Fold pattern.
default foldrPattern :: (Monoid m, Foldable f, PatternLike a p, f p ~ b) => (Pattern' a -> m -> m) -> b -> m Source #
:: Monad m | |
=> (Pattern' a -> m (Pattern' a)) |
|
-> (Pattern' a -> m (Pattern' a)) |
|
-> b | |
-> m b |
Traverse pattern.
default traversePatternM :: (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 b => PatternLike a [b] Source # | |
Defined in Agda.Syntax.Internal.Pattern | |
PatternLike a (Pattern' a) Source # | |
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.
:: (PatternLike a b, Monad m) | |
=> (Pattern' a -> m (Pattern' a)) |
|
-> b | |
-> m b |
Traverse pattern(s) with a modification before the recursive descent.
:: (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 #
Nothing
countPatternVars :: a -> Int Source #
default countPatternVars :: (Foldable f, CountPatternVars b, f b ~ a) => a -> Int Source #
Instances
CountPatternVars a => CountPatternVars [a] Source # | |
Defined in Agda.Syntax.Internal.Pattern countPatternVars :: [a] -> Int Source # | |
CountPatternVars a => CountPatternVars (Arg a) Source # | |
Defined in Agda.Syntax.Internal.Pattern countPatternVars :: Arg a -> Int Source # | |
CountPatternVars (Pattern' x) Source # | |
Defined in Agda.Syntax.Internal.Pattern countPatternVars :: Pattern' x -> Int Source # | |
CountPatternVars a => CountPatternVars (Named x a) Source # | |
Defined in Agda.Syntax.Internal.Pattern countPatternVars :: Named x a -> Int Source # |
class PatternVarModalities p x | p -> x where Source #
patternVarModalities :: p -> [(x, Modality)] Source #
Get the list of pattern variables annotated with modalities.
Instances
PatternVarModalities a x => PatternVarModalities [a] x Source # | |
Defined in Agda.Syntax.Internal.Pattern patternVarModalities :: [a] -> [(x, Modality)] Source # | |
PatternVarModalities a x => PatternVarModalities (Arg a) x Source # | |
Defined in Agda.Syntax.Internal.Pattern patternVarModalities :: Arg a -> [(x, Modality)] Source # | |
PatternVarModalities (Pattern' x) x Source # | |
Defined in Agda.Syntax.Internal.Pattern patternVarModalities :: Pattern' x -> [(x, Modality)] Source # | |
PatternVarModalities a x => PatternVarModalities (Named s a) x Source # | |
Defined in Agda.Syntax.Internal.Pattern patternVarModalities :: Named s a -> [(x, Modality)] Source # |