Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains functions for generating Coq function, constructor and type arguments from our intermediate representation.
Synopsis
- convertTypeVarDecls :: Explicitness -> [TypeVarDecl] -> Converter [Binder]
- convertTypeVarDecls' :: Explicitness -> [TypeVarDecl] -> Converter ([Qualid], [Binder])
- convertArg :: VarPat -> Converter Binder
- generateArgBinder :: Qualid -> Maybe Term -> Converter Binder
- convertAnonymousArg :: Maybe Type -> Converter (Qualid, Binder)
Documentation
:: Explicitness | Whether to generate an explicit or implicit binder. |
-> [TypeVarDecl] | The type variable declarations. |
-> Converter [Binder] |
Converts the declarations of type variables in the head of a data type or type synonym declaration to a Coq binder for a set of explicit or implicit type arguments.
E.g. the declaration of the type variable a
in data D a = ...
is
translated to the binder (a : Type)
. If there are multiple type variable
declarations as in data D a b = ...
they are grouped into a single
binder (a b : Type)
, because we assume all Haskell type variables to be
of kind *
.
The first argument controls whether the generated binders are explicit
(e.g. (a : Type)
) or implicit (e.g. {a : Type}
).
:: Explicitness | Whether to generate an explicit or implicit binder. |
-> [TypeVarDecl] | The type variable declarations. |
-> Converter ([Qualid], [Binder]) |
Like convertTypeVarDecls
but also returns the Coq identifiers of the
bound variables.
convertArg :: VarPat -> Converter Binder Source #
Converts the argument of a function (a variable pattern) to an explicit Coq binder.
If the variable pattern has a type annotation, the generated binder is
annotated with the converted type. If the variable pattern is strict, the
variable is marked as non-monadic and the converted type is not
lifted to the Free
monad.
generateArgBinder :: Qualid -> Maybe Term -> Converter Binder Source #
Generates an explicit Coq binder for a function argument with the given name and optional Coq type.
If no type is provided, it will be inferred by Coq.