Get true constructor with record fields.
ModuleAgda-2.7.0.1Haskell2010
Agda.TypeChecking.Datatypes
- 1 type
- 22 values
- PackageAgda-2.7.0.1
- Exports23
- LanguageHaskell2010
- LicenceMIT
- SourceDatatypes.hs
Constructors
14 declarationsGet true constructor with fields, expanding literals to constructors if possible.
Augment constructor with record fields (preserve constructor name). The true constructor might only surface via reduce.
Get the name of the datatype constructed by a given constructor. Precondition: The argument must refer to a constructor
Is the datatype of this constructor a Higher Inductive Type? Precondition: The argument must refer to a constructor of a datatype or record.
getFullyAppliedConType :: PureTCM m=> ConHeadConstructor.
-> TypeReduced type of the fully applied constructor.
-> m (Maybe ((QName, Type, Args), Type))Nothingif not data or record type.Just ((d, dt, pars), ct)otherwise, wheredis the data or record type name,dtis the type of the data or record name,parsare the reconstructed parameters,ctis the type of the constructor instantiated to the parameters.
getFullyAppliedConType c t computes the constructor parameters
from data type t and returns them
plus the instantiated type of constructor c.
Nothing if t is not a data/record type or does not have
a constructor c.
Precondition: t is reduced.
fullyApplyCon :: (PureTCM m, MonadBlock m, MonadTCError m)=> ConHeadConstructor.
-> ElimsConstructor arguments.
-> TypeType of the constructor application.
-> (QName -> Type -> Args -> Type -> Elims -> Telescope -> Type -> m a)Name of the data/record type, type of the data/record type, reconstructed parameters, type of the constructor (applied to parameters), full application arguments, types of missing arguments (already added to context), type of the full application.
-> m a
Make sure a constructor is fully applied and infer the type of the constructor. Raises a type error if the constructor does not belong to the given type.
fullyApplyCon' Like fullyApplyCon, but calls the given fallback function if
it encounters something other than a datatype.
getConType :: (PureTCM m, MonadBlock m)=> ConHeadConstructor.
-> TypeEnding in data/record type.
-> m (Maybe ((QName, Type, Args), Type))Nothingif not ends in data or record type.Just ((d, dt, pars), ct)otherwise, wheredis the data or record type name,dtis the type of the data or record name,parsare the reconstructed parameters,ctis the type of the constructor instantiated to the parameters.
getConType c t computes the constructor parameters from type t
and returns them plus the instantiated type of constructor c.
This works also if t is a function type ending in a data/record type;
the term from which c comes need not be fully applied
Nothing if t is not a data/record type or does not have
a constructor c.
Return the number of non-parameter arguments to a constructor (arity). In case of record constructors, also return the field names (plus other info).
Data types
9 declarationsCheck if a name refers to a datatype or a record with a named constructor.
Check if a name refers to a datatype or a record.
This is a simplified version of isDatatype from Coverage,
useful when we do not want to import the module.
Precondition: Name is a data or record type.
Nothing if not data or record type name.
Nothing if not data or record definition.