diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-05-14 08:13:54 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-05-14 08:13:54 -0400 |
commit | fdc4582e7fbfaecebaa2d27660a0184d9949b232 (patch) | |
tree | cd83a1670f329d23e70b5b1017d2ead58829009c /lib/ur | |
parent | 8c48972ebbb4fa43af6dee99b79648fe1546d867 (diff) |
Improving/reordering Unpoly and Especialize; pathmaps
Diffstat (limited to 'lib/ur')
-rw-r--r-- | lib/ur/list.ur | 31 | ||||
-rw-r--r-- | lib/ur/list.urs | 8 |
2 files changed, 39 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur new file mode 100644 index 00000000..5310c810 --- /dev/null +++ b/lib/ur/list.ur @@ -0,0 +1,31 @@ +datatype t = datatype Basis.list + +val show (a ::: Type) (_ : show a) = + let + fun show' (ls : list a) = + case ls of + [] => "[]" + | x :: ls => show x ^ " :: " ^ show' ls + in + mkShow show' + end + +val rev (a ::: Type) = + let + fun rev' acc (ls : list a) = + case ls of + [] => acc + | x :: ls => rev' (x :: acc) ls + in + rev' [] + end + +fun mp (a ::: Type) (b ::: Type) f = + let + fun mp' acc ls = + case ls of + [] => rev acc + | x :: ls => mp' (f x :: acc) ls + in + mp' [] + end diff --git a/lib/ur/list.urs b/lib/ur/list.urs new file mode 100644 index 00000000..879648ea --- /dev/null +++ b/lib/ur/list.urs @@ -0,0 +1,8 @@ +datatype t = datatype Basis.list + +val show : a ::: Type -> show a -> show (list a) + +val rev : a ::: Type -> t a -> t a + +val mp : a ::: Type -> b ::: Type -> (a -> b) -> t a -> t b + |