diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-10-19 11:51:53 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-10-19 11:51:53 -0400 |
commit | ea94abf0f7df95202c417252aa3dbd3a63e44870 (patch) | |
tree | d7e12d54949ab6dec7a3ba37dffbeb9f7e5bca38 /lib/ur/monad.ur | |
parent | 16caf37ac168116b001502713571a87649a64664 (diff) |
Monad.appR
Diffstat (limited to 'lib/ur/monad.ur')
-rw-r--r-- | lib/ur/monad.ur | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ur/monad.ur b/lib/ur/monad.ur index 487aef26..0eb1a251 100644 --- a/lib/ur/monad.ur +++ b/lib/ur/monad.ur @@ -93,6 +93,16 @@ fun foldMapR [K] [m] (_ : monad m) [tf :: K -> Type] [tf' :: K -> Type] [tr :: { (fn _ => return ({}, i)) fl +fun appR [K] [m] (_ : monad m) [tf :: K -> Type] + (f : nm :: Name -> t :: K -> tf t -> m unit) + [r ::: {K}] (fl : folder r) = + @Top.fold [fn r :: {K} => $(map tf r) -> m unit] + (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r => + acc (r -- nm); + f [nm] [t] r.nm) + (fn _ => return ()) + fl + fun appR2 [K] [m] (_ : monad m) [tf1 :: K -> Type] [tf2 :: K -> Type] (f : nm :: Name -> t :: K -> tf1 t -> tf2 t -> m unit) [r ::: {K}] (fl : folder r) = |