mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 17:12:50 -06:00
Transfer: derive instances, not functions.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import prelude
|
||||
|
||||
data Cat : Type where
|
||||
Stm : Cat
|
||||
Exp : Cat
|
||||
@@ -20,11 +22,12 @@ data Tree : Cat -> Type where
|
||||
NilStm : Tree ListStm
|
||||
ConsStm : Tree Stm -> Tree ListStm -> Tree ListStm
|
||||
|
||||
derive composOp Tree
|
||||
derive Compos Tree
|
||||
|
||||
rename : (String -> String) -> (C : Type) -> Tree C -> Tree C
|
||||
rename f C t = case t of
|
||||
V x -> V (f x)
|
||||
_ -> composOp_Tree C (rename f) t
|
||||
_ -> composOp ? ? compos_Tree C (rename f) t
|
||||
|
||||
|
||||
main = rename (const ? ? "apa") Stm (SAss (V "y") (EAdd (EVar (V "x")) (EInt 2)))
|
||||
Reference in New Issue
Block a user