1
0
forked from GitHub/gf-core

Simple transfer tutorial touch-up.

This commit is contained in:
bringert
2005-12-06 16:26:55 +00:00
parent 95854ea11b
commit 099e5068d7
3 changed files with 42 additions and 43 deletions

View File

@@ -1,44 +1,12 @@
import prelude
import tree
derive Eq Tree
derive Compos Tree
-- When the Transfer compiler gets meta variable inference,
-- we can write:
{-
aggreg : (A : Type) -> Tree A -> Tree A
aggreg _ t =
case t of
ConjS c s1 s2 ->
case (aggreg ? s1, aggreg ? s2) of
(Pred np1 vp1, Pred np2 vp2) | np1 == np2 ->
Pred np1 (ConjVP c vp1 vp2)
(Pred np1 vp1, Pred np2 vp2) | vp1 == vp2 ->
Pred (ConjNP c np1 np2) vp1
(s1',s2') -> ConjS c s1' s2'
_ -> composOp ? ? ? ? aggreg t
-}
-- Adding hidden arguments, we could write something like:
{-
aggreg : (A : Type) => Tree A -> Tree A
aggreg t =
case t of
ConjS c s1 s2 ->
case (aggreg s1, aggreg s2) of
(Pred np1 vp1, Pred np2 vp2) | np1 == np2 ->
Pred np1 (ConjVP c vp1 vp2)
(Pred np1 vp1, Pred np2 vp2) | vp1 == vp2 ->
Pred (ConjNP c np1 np2) vp1
(s1',s2') -> ConjS c s1' s2'
_ -> composOp aggreg t
-}
-- aggreg specialized for Tree S
aggregS : Tree S -> Tree S
aggregS = aggreg S
-- For now, here's what we have to do:
aggreg : (A : Type) -> Tree A -> Tree A
aggreg _ t =
case t of
@@ -52,6 +20,37 @@ aggreg _ t =
_ -> composOp ? ? compos_Tree ? aggreg t
-- aggreg specialized for Tree S
aggregS : Tree S -> Tree S
aggregS = aggreg S
{-
-- When the Transfer compiler gets meta variable inference,
-- we can write this:
aggreg : (A : Type) -> Tree A -> Tree A
aggreg _ t =
case t of
ConjS c s1 s2 ->
case (aggreg ? s1, aggreg ? s2) of
(Pred np1 vp1, Pred np2 vp2) | np1 == np2 ->
Pred np1 (ConjVP c vp1 vp2)
(Pred np1 vp1, Pred np2 vp2) | vp1 == vp2 ->
Pred (ConjNP c np1 np2) vp1
(s1',s2') -> ConjS c s1' s2'
_ -> composOp ? ? ? ? aggreg t
-}
{-
-- If we added idden arguments, we could write something like this:
aggreg : (A : Type) => Tree A -> Tree A
aggreg t =
case t of
ConjS c s1 s2 ->
case (aggreg s1, aggreg s2) of
(Pred np1 vp1, Pred np2 vp2) | np1 == np2 ->
Pred np1 (ConjVP c vp1 vp2)
(Pred np1 vp1, Pred np2 vp2) | vp1 == vp2 ->
Pred (ConjNP c np1 np2) vp1
(s1',s2') -> ConjS c s1' s2'
_ -> composOp aggreg t
-}