Last active
August 29, 2015 14:14
-
-
Save UnkindPartition/aab02fb2699f1ae40c40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
mutual | |
data Ty = TyInt | TyFun Ty Ty | TyData DataDesc | |
data DataDesc = | |
MkDataDesc | |
String -- data type name | |
(List ConDesc) -- list of constructors | |
data ConDesc : Type where | |
MkConDesc | |
: (d: DataDesc) -- parent data type | |
-> (conElem ?con d) -- ?con should refer to this very value we're defining | |
-> String -- constructor name | |
-> (List Ty) -- list of fields | |
-> ConDesc | |
||| Proof that a constructor belongs to a datatype | |
conElem : ConDesc -> DataDesc -> Type | |
conElem con (MkDataDesc _ constrs) = Elem con constrs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment