summaryrefslogtreecommitdiff
path: root/lib/ur/monad.ur
blob: 7300109415da958adf82fe2def4ed36343a54a9f (plain)
1
2
3
4
5
6
7
8
9
fun exec [m ::: Type -> Type] (_ : monad m) [ts ::: {Type}] r (fd : folder ts) =
    foldR [m] [fn ts => m $ts]
    (fn [nm :: Name] [v :: Type] [rest :: {Type}] [[nm] ~ rest] action acc =>
        this <- action;
        others <- acc;
        return ({nm = this} ++ others))
    (return {}) [ts] fd r

fun ignore [m ::: Type -> Type] (_ : monad m) [t] (v : m t) = x <- v; return ()