Agda-2.4.2.1: A dependently typed functional programming language and proof assistant

Safe HaskellNone
LanguageHaskell98

Agda.TypeChecking.Rules.LHS

Synopsis

Documentation

flexiblePatterns :: [NamedArg Pattern] -> TCM FlexibleVars Source

Compute the set of flexible patterns in a list of patterns. The result is the deBruijn indices of the flexible patterns. A pattern is flexible if it is dotted or implicit.

dotPatternInsts :: [NamedArg Pattern] -> Substitution -> [Dom Type] -> TCM [DotPatternInst] Source

Compute the dot pattern instantiations.

isSolvedProblem :: Problem -> Bool Source

Check if a problem is solved. That is, if the patterns are all variables.

noShadowingOfConstructors Source

Arguments

:: (Maybe r -> Call)

Trace, e.g., CheckPatternShadowing clause

-> Problem 
-> TCM () 

For each user-defined pattern variable in the Problem, check that the corresponding data type (if any) does not contain a constructor of the same name (which is not in scope); this "shadowing" could indicate an error, and is not allowed.

Precondition: The problem has to be solved.

checkDotPattern :: DotPatternInst -> TCM () Source

Check that a dot pattern matches it's instantiation.

bindLHSVars :: [NamedArg Pattern] -> Telescope -> TCM a -> TCM a Source

Bind the variables in a left hand side. Precondition: the patterns should all be VarP, WildP, AbsurdP, or ImplicitP and the telescope should have the same size as the pattern list. There could also be ConPs resulting from eta expanded implicit record patterns.

bindAsPatterns :: [AsBinding] -> TCM a -> TCM a Source

Bind as patterns

data LHSResult Source

Constructors

LHSResult 

Fields

lhsPatternTele :: Maybe Telescope

Γ: The types of the patterns. Nothing if more patterns than domain types in a. Used only to construct a with function; see stripwithClausePatterns.

lhsVarTele :: Telescope

Δ : The types of the pattern variables.

lhsSubstitution :: Substitution

σ : The patterns in form of a substitution Δ ⊢ σ : Γ

lhsVarNames :: [String]

Names for the variables in Δ, for binding the body.

lhsPatterns :: [NamedArg Pattern]

The patterns in internal syntax.

lhsBodyType :: Arg Type

The type of the body. Is if Γ is defined. Irrelevant to indicate the rhs must be checked in irrelevant mode.

lhsPermutation :: Permutation

The permutation from pattern vars to Δ.

checkLeftHandSide Source

Arguments

:: (Maybe r -> Call)

Trace, e.g. CheckPatternShadowing clause

-> Maybe QName

The name of the definition we are checking.

-> [NamedArg Pattern]

The patterns.

-> Type

The expected type a = Γ → b.

-> (LHSResult -> TCM a)

Continuation.

-> TCM a 

Check a LHS. Main function.

checkLeftHandSide a ps a ret checks that user patterns ps eliminate the type a of the defined function, and calls continuation ret if successful.

checkLHS Source

Arguments

:: Maybe QName

The name of the definition we are checking.

-> LHSState

The current state.

-> TCM LHSState

The final state after all splitting is completed

The loop (tail-recursive): split at a variable in the problem until problem is solved

noPatternMatchingOnCodata :: [NamedArg Pattern] -> TCM () Source

Ensures that we are not performing pattern matching on codata.