From 17b3f5af99c07d7361fb99124412aff1768cfe13 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 21 Oct 2008 19:24:39 -0400 Subject: Sum demo, minus inference of {Unit}s --- lib/top.urs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/top.urs') diff --git a/lib/top.urs b/lib/top.urs index bf26d534..abdb7477 100644 --- a/lib/top.urs +++ b/lib/top.urs @@ -6,6 +6,9 @@ con sndTT = fn t :: (Type * Type) => t.2 con mapTT = fn f :: Type -> Type => fold (fn nm t acc [[nm] ~ acc] => [nm = f t] ++ acc) [] +con mapUT = fn f :: Type => fold (fn nm t acc [[nm] ~ acc] => + [nm = f] ++ acc) [] + con mapT2T = fn f :: (Type * Type) -> Type => fold (fn nm t acc [[nm] ~ acc] => [nm = f t] ++ acc) [] @@ -20,6 +23,12 @@ val compose : t1 ::: Type -> t2 ::: Type -> t3 ::: Type val txt : t ::: Type -> ctx ::: {Unit} -> use ::: {Type} -> show t -> t -> xml ctx use [] +val foldUR : tf :: Type -> tr :: ({Unit} -> Type) + -> (nm :: Name -> rest :: {Unit} + -> fn [[nm] ~ rest] => + tf -> tr rest -> tr ([nm] ++ rest)) + -> tr [] -> r :: {Unit} -> $(mapUT tf r) -> tr r + val foldTR : tf :: (Type -> Type) -> tr :: ({Type} -> Type) -> (nm :: Name -> t :: Type -> rest :: {Type} -> fn [[nm] ~ rest] => -- cgit v1.2.3