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

Safe Haskell | None
Language | Haskell2010

Agda.TypeChecking.InstanceArguments

Synopsis

- initialIFSCandidates :: Type -> TCM (Maybe [Candidate])
- findInScope :: MetaId -> Maybe [Candidate] -> TCM ()
- findInScope' :: MetaId -> [Candidate] -> TCM (Maybe ([Candidate], Maybe MetaId))
- insidePi :: Type -> (Type -> TCM a) -> TCM a
- rigidlyConstrainedMetas :: TCM [MetaId]
- isRigid :: MetaId -> TCM Bool
- areThereNonRigidMetaArguments :: Term -> TCM (Maybe MetaId)
- filterResetingState :: MetaId -> [Candidate] -> (Candidate -> TCM YesNoMaybe) -> TCM [Candidate]
- dropSameCandidates :: MetaId -> [(Candidate, Term, Type, a)] -> TCM [(Candidate, Term, Type, a)]
- data YesNoMaybe
  - = Yes
  - | No
  - | Maybe
  - | HellNo TCErr
- isNo :: YesNoMaybe -> Bool
- checkCandidates :: MetaId -> Type -> [Candidate] -> TCM (Maybe [Candidate])
- isIFSConstraint :: Constraint -> Bool
- applyDroppingParameters :: Term -> Args -> TCM Term

# Documentation

initialIFSCandidates :: Type -> TCM (Maybe [Candidate]) #

Compute a list of instance candidates. `Nothing` if type is a meta, error if type is not eligible for instance search.

findInScope :: MetaId -> Maybe [Candidate] -> TCM () #

`findInScope m (v,a)s` tries to instantiate on of the types `a`s of the candidate terms `v`s to the type `t` of the metavariable `m`. If successful, meta `m` is solved with the instantiation of `v`. If unsuccessful, the constraint is regenerated, with possibly reduced candidate set. The list of candidates is equal to `Nothing` when the type of the meta wasn't known when the constraint was generated. In that case, try to find its type again.

findInScope' :: MetaId -> [Candidate] -> TCM (Maybe ([Candidate], Maybe MetaId)) #

Result says whether we need to add constraint, and if so, the set of remaining candidates and an eventual blocking metavariable.

insidePi :: Type -> (Type -> TCM a) -> TCM a #

Precondition: type is spine reduced and ends in a Def or a Var.

rigidlyConstrainedMetas :: TCM [MetaId] #

A meta _M is rigidly constrained if there is a constraint _M us == D vs, for inert D. Such metas can safely be instantiated by recursive instance search, since the constraint limits the solution space.

isRigid :: MetaId -> TCM Bool #

areThereNonRigidMetaArguments :: Term -> TCM (Maybe MetaId) #

Returns True if one of the arguments of `t` is a meta which isn’t rigidly constrained. Note that level metas are never considered rigidly constrained (#1865).

filterResetingState :: MetaId -> [Candidate] -> (Candidate -> TCM YesNoMaybe) -> TCM [Candidate] #

Apply the computation to every argument in turn by reseting the state every time. Return the list of the arguments giving the result True.

If the resulting list contains exactly one element, then the state is the same as the one obtained after running the corresponding computation. In all the other cases, the state is reseted.

dropSameCandidates :: MetaId -> [(Candidate, Term, Type, a)] -> TCM [(Candidate, Term, Type, a)] #

data YesNoMaybe #

Constructors

Yes |
No |
Maybe |
HellNo TCErr |

Instances

Show YesNoMaybe # |
Methods showsPrec :: Int -> YesNoMaybe -> ShowS # show :: YesNoMaybe -> String # showList :: [YesNoMaybe] -> ShowS #

isNo :: YesNoMaybe -> Bool #

checkCandidates :: MetaId -> Type -> [Candidate] -> TCM (Maybe [Candidate]) #

Given a meta `m` of type `t` and a list of candidates `cands`, `checkCandidates m t cands` returns a refined list of valid candidates.

isIFSConstraint :: Constraint -> Bool #

applyDroppingParameters :: Term -> Args -> TCM Term #

To preserve the invariant that a constructor is not applied to its parameter arguments, we explicitly check whether function term we are applying to arguments is a unapplied constructor. In this case we drop the first `conPars` arguments. See Issue670a. Andreas, 2013-11-07 Also do this for projections, see Issue670b.