diff options
-rw-r--r-- | lib/ur/monad.ur | 10 | ||||
-rw-r--r-- | lib/ur/monad.urs | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/ur/monad.ur b/lib/ur/monad.ur index 0eb1a251..c64c8fb9 100644 --- a/lib/ur/monad.ur +++ b/lib/ur/monad.ur @@ -112,3 +112,13 @@ fun appR2 [K] [m] (_ : monad m) [tf1 :: K -> Type] [tf2 :: K -> Type] f [nm] [t] r1.nm r2.nm) (fn _ _ => return ()) fl + +fun appR3 [K] [m] (_ : monad m) [tf1 :: K -> Type] [tf2 :: K -> Type] [tf3 :: K -> Type] + (f : nm :: Name -> t :: K -> tf1 t -> tf2 t -> tf3 t -> m unit) + [r ::: {K}] (fl : folder r) = + @Top.fold [fn r :: {K} => $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> m unit] + (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r1 r2 r3 => + acc (r1 -- nm) (r2 -- nm) (r3 -- nm); + f [nm] [t] r1.nm r2.nm r3.nm) + (fn _ _ _ => return ()) + fl diff --git a/lib/ur/monad.urs b/lib/ur/monad.urs index 0bfef87a..d07d5026 100644 --- a/lib/ur/monad.urs +++ b/lib/ur/monad.urs @@ -70,3 +70,8 @@ val appR2 : K --> m ::: (Type -> Type) -> monad m -> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> m unit) -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> m unit + +val appR3 : K --> m ::: (Type -> Type) -> monad m + -> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type) + -> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> tf3 t -> m unit) + -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> m unit |