3%language ElabReflection
6foo = do declareDatatype $ Declare `{{DataDef.N}} [MkFunArg `{{n}} `(Nat) Explicit NotErased] `(Type)
7 defineDatatype $ DefineDatatype `{{DataDef.N}} [
8 Constructor `{{MkN}} [MkFunArg `{{x}} `(Nat) Implicit NotErased] (RApp (Var `{{DataDef.N}}) (Var `{{x}})),
9 Constructor `{{MkN'}} [MkFunArg `{{x}} `(Nat) Explicit NotErased] (RApp (Var `{{DataDef.N}}) (RApp (Var `{S}) (Var `{{x}})))
23-- Pi : (code : U) -> (el code -> U) -> U
26-- el (Pi code body) = (x : el code) -> el (body x)
31mkU = do let U = `{{DataDef.U}}
32 let el = `{{DataDef.el}}
33 declareDatatype $ Declare U [] `(Type)
34 declareType $ Declare el [MkFunArg `{{code}} (Var U) Explicit NotErased] `(Type)
35 defineDatatype $ DefineDatatype U [
36 Constructor `{{Base}} [] (Var U),
38 [MkFunArg `{{code}} (Var U) Explicit NotErased,
39 MkFunArg `{{body}} `(~(RApp (Var el) (Var `{{code}})) -> ~(Var U)) Explicit NotErased]
42 defineFunction $ DefineFun el [
43 MkFunClause (RBind `{{code}} (PVar (Var U))
44 (RBind `{{body}} (PVar `(~(RApp (Var el) (Var `{{code}})) -> ~(Var U)))
46 (RApp (RApp (Var `{{DataDef.Pi}})
49 (RBind `{{code}} (PVar (Var U))
50 (RBind `{{body}} (PVar `(~(RApp (Var el) (Var `{{code}})) -> ~(Var U)))
51 (RBind `{{x}} (Pi (RApp (Var el) (Var `{{code}})) `(Type))
52 (RApp (Var el) (RApp (Var `{{body}}) (Var `{{x}})))))),
53 MkFunClause (RApp (Var el) (Var `{{DataDef.Base}})) `(Bool)
62fun : el (Pi Base (\x => if x then Base else Pi Base (const Base)))
69nope = defineDatatype $ DefineDatatype `{Either} [
70 Constructor `{{Middle}} [ MkFunArg `{{x}} `(Type) Implicit NotErased
71 , MkFunArg `{{y}} `(Type) Implicit NotErased
72 ] `(Either ~(Var `{{x}}) ~(Var `{{y}}))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list