-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathElabs.idr
36 lines (30 loc) · 871 Bytes
/
Elabs.idr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Elabs
import Language.Reflection.Elab
import Derive.Show
%language ElabReflection
-- https://github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Language/Reflection/Elab.idr
addDecls : Elab ()
addDecls = do
-- declareType (Declare (UN "Tpe") [] (RType) )
-- intro `{{x}}
-- declareType $ Declare `{{FF}} [] RType
declareDatatype $ Declare `{{FF}} [] RType
defineDatatype $ DefineDatatype `{{FF}} []
-- let xs = map (\x=>declareType (Declare (UN x) [] (RType) )) [""]
pure ()
-- data FF
%runElab addDecls
xx : FF -> ()
xx x = ()
%runElab (deriveShow `{{FF}})
-- %runElab defineFunction (DefineFun (UN "myf") [MkFunClause (Var `{{x}}) (Var `{{x}}) ])
-- %runElab `{{}}`
{-
xxx : Tpe -> IO ()
xxx _ = do
print ""
-}
idNat : Nat -> Nat
idNat = %runElab (do intro `{{x}}
fill (Var `{{x}})
solve)