Safe Haskell | None |
---|
- orderFields :: QName -> a -> [Name] -> [(Name, a)] -> TCM [a]
- recordModule :: QName -> ModuleName
- getRecordDef :: QName -> TCM Defn
- getRecordOfField :: QName -> TCM (Maybe QName)
- getRecordFieldNames :: QName -> TCM [Arg Name]
- recordFieldNames :: Defn -> [Arg Name]
- findPossibleRecords :: [Name] -> TCM [QName]
- getRecordFieldTypes :: QName -> TCM Telescope
- getRecordTypeFields :: Type -> TCM [Arg QName]
- getRecordConstructorType :: QName -> TCM Type
- getRecordConstructor :: QName -> TCM ConHead
- isRecord :: HasConstInfo m => QName -> m (Maybe Defn)
- isRecordType :: Type -> TCM (Maybe (QName, Args, Defn))
- tryRecordType :: Type -> TCM (Either (Maybe Type) (QName, Args, Defn))
- projectType :: Type -> QName -> TCM (Maybe Type)
- isEtaRecord :: HasConstInfo m => QName -> m Bool
- isEtaCon :: HasConstInfo m => QName -> m Bool
- isInductiveRecord :: QName -> TCM Bool
- isEtaRecordType :: Type -> TCM (Maybe (QName, Args))
- isRecordConstructor :: QName -> TCM (Maybe (QName, Defn))
- isGeneratedRecordConstructor :: QName -> TCM Bool
- unguardedRecord :: QName -> TCM ()
- recursiveRecord :: QName -> TCM ()
- isRecursiveRecord :: QName -> TCM Bool
- recRecursive_ :: Defn -> Bool
- etaExpandBoundVar :: Int -> TCM (Maybe (Telescope, Substitution, Substitution))
- curryAt :: Type -> Int -> TCM (Term -> Term, Term -> Term, Type)
- etaExpandRecord :: QName -> Args -> Term -> TCM (Telescope, Args)
- etaExpandRecord_ :: QName -> Args -> Defn -> Term -> TCM (Telescope, ConHead, Args)
- etaExpandAtRecordType :: Type -> Term -> TCM (Telescope, Term)
- etaContractRecord :: HasConstInfo m => QName -> ConHead -> Args -> m Term
- isSingletonRecord :: QName -> Args -> TCM (Either MetaId Bool)
- isSingletonRecordModuloRelevance :: QName -> Args -> TCM (Either MetaId Bool)
- isSingletonRecord' :: Bool -> QName -> Args -> TCM (Either MetaId (Maybe Term))
- isSingletonType :: Type -> TCM (Either MetaId (Maybe Term))
- isSingletonTypeModuloRelevance :: MonadTCM tcm => Type -> tcm (Either MetaId Bool)
- isSingletonType' :: Bool -> Type -> TCM (Either MetaId (Maybe Term))
- emap :: (a -> b) -> Either c (Maybe a) -> Either c (Maybe b)
Documentation
orderFields :: QName -> a -> [Name] -> [(Name, a)] -> TCM [a]Source
Order the fields of a record construction. Use the second argument for missing fields.
recordModule :: QName -> ModuleNameSource
The name of the module corresponding to a record.
getRecordDef :: QName -> TCM DefnSource
Get the definition for a record. Throws an exception if the name does not refer to a record or the record is abstract.
getRecordOfField :: QName -> TCM (Maybe QName)Source
Get the record name belonging to a field name.
recordFieldNames :: Defn -> [Arg Name]Source
findPossibleRecords :: [Name] -> TCM [QName]Source
Find all records with at least the given fields.
getRecordFieldTypes :: QName -> TCM TelescopeSource
Get the field types of a record.
getRecordConstructorType :: QName -> TCM TypeSource
Get the type of the record constructor.
getRecordConstructor :: QName -> TCM ConHeadSource
Returns the given record type's constructor name (with an empty range).
isRecord :: HasConstInfo m => QName -> m (Maybe Defn)Source
Check if a name refers to a record. If yes, return record definition.
isRecordType :: Type -> TCM (Maybe (QName, Args, Defn))Source
Reduce a type and check whether it is a record type. Succeeds only if type is not blocked by a meta var. If yes, return its name, parameters, and definition.
tryRecordType :: Type -> TCM (Either (Maybe Type) (QName, Args, Defn))Source
Reduce a type and check whether it is a record type. Succeeds only if type is not blocked by a meta var. If yes, return its name, parameters, and definition. If no, return the reduced type (unless it is blocked).
projectType :: Type -> QName -> TCM (Maybe Type)Source
The analogue of piApply
. If v
is a value of record type T
with field f
, then projectType T f
returns the type of f v
.
isEtaRecord :: HasConstInfo m => QName -> m BoolSource
Check if a name refers to an eta expandable record.
isEtaCon :: HasConstInfo m => QName -> m BoolSource
isInductiveRecord :: QName -> TCM BoolSource
Check if a name refers to a record which is not coinductive. (Projections are then size-preserving)
isEtaRecordType :: Type -> TCM (Maybe (QName, Args))Source
Check if a type is an eta expandable record and return the record identifier and the parameters.
isRecordConstructor :: QName -> TCM (Maybe (QName, Defn))Source
Check if a name refers to a record constructor. If yes, return record definition.
isGeneratedRecordConstructor :: QName -> TCM BoolSource
Check if a constructor name is the internally generated record constructor.
unguardedRecord :: QName -> TCM ()Source
Mark record type as unguarded. No eta-expansion. Projections do not preserve guardedness.
recursiveRecord :: QName -> TCM ()Source
Mark record type as recursive. Projections do not preserve guardedness.
isRecursiveRecord :: QName -> TCM BoolSource
Check whether record type is marked as recursive.
Precondition: record type identifier exists in signature.
recRecursive_ :: Defn -> BoolSource
Version of recRecursive
with proper internal error.
etaExpandBoundVar :: Int -> TCM (Maybe (Telescope, Substitution, Substitution))Source
etaExpandRecord :: QName -> Args -> Term -> TCM (Telescope, Args)Source
etaExpand r pars u
computes the eta expansion of record value u
at record type r pars
.
The first argument r
should be the name of a record type. Given
record R : Set where field x : A; y : B; .z : C
and r : R
,
etaExpand R [] r = (tel, [R.x r, R.y r, R.z r])
where tel
is the record telescope instantiated at the parameters pars
.
etaContractRecord :: HasConstInfo m => QName -> ConHead -> Args -> m TermSource
The fields should be eta contracted already.
We can eta contract if all fields f = ...
are irrelevant
or all fields f
are the projection f v
of the same value v
,
but we need at least one relevant field to find the value v
.
TODO: this can be moved out of TCM (but only if ConHead stores also the Arg-decoration of the record fields.
isSingletonRecord :: QName -> Args -> TCM (Either MetaId Bool)Source
Is the type a hereditarily singleton record type? May return a blocking metavariable.
Precondition: The name should refer to a record type, and the arguments should be the parameters to the type.
isSingletonRecord' :: Bool -> QName -> Args -> TCM (Either MetaId (Maybe Term))Source
Return the unique (closed) inhabitant if exists. In case of counting irrelevance in, the returned inhabitant contains garbage.
isSingletonType :: Type -> TCM (Either MetaId (Maybe Term))Source
Check whether a type has a unique inhabitant and return it. Can be blocked by a metavar.
isSingletonTypeModuloRelevance :: MonadTCM tcm => Type -> tcm (Either MetaId Bool)Source
Check whether a type has a unique inhabitant (irrelevant parts ignored). Can be blocked by a metavar.