summaryrefslogtreecommitdiff
path: root/transfer/examples/array.tr
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2005-11-25 16:36:19 +0000
committerbringert <bringert@cs.chalmers.se>2005-11-25 16:36:19 +0000
commitdbe8e61acc616b8f5ac07e8df89eb98a7997c29d (patch)
tree6e379f18986fc60f5606e023def46abdf770dca5 /transfer/examples/array.tr
parentfe2731e5f8e301b5a0169bf8b667bb6c13bae80b (diff)
Move transfer into the GF repo.
Diffstat (limited to 'transfer/examples/array.tr')
-rw-r--r--transfer/examples/array.tr10
1 files changed, 10 insertions, 0 deletions
diff --git a/transfer/examples/array.tr b/transfer/examples/array.tr
new file mode 100644
index 000000000..7dcf6d443
--- /dev/null
+++ b/transfer/examples/array.tr
@@ -0,0 +1,10 @@
+import nat ;
+
+data Array : Type -> Nat -> Type where {
+ Empty : (A:Type) -> Array A Zero ;
+ Cell : (A:Type) -> (n:Nat) -> A -> Array A n -> Array A (Succ n) ;
+ } ;
+
+mapA : (A:Type) -> (B:Type) -> (n:Nat) -> (A -> B) -> Array A n -> Array B n ;
+mapA A B _ f (Empty _) = Empty B ;
+mapA A B (Succ n) f (Cell _ _ x xs) = Cell B n (f x) (mapA A B n f xs) ;