view lib/ur/monad.ur @ 904:6d9538ce94d8

Fix type class resolution infinite loop, discovered while meeting with Ezra
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Aug 2009 15:23:04 -0400
parents d1d0b18afd3d
children 7a4b026e45dd
line wrap: on
line source
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 ()