I never intended to imply that lack of effect segregation imposition means that there can be no Monads in SML, I was just replying to that particular tidbit of his.
While there may very well be monads in SML, he still haven't made it clear the Monad abstraction is possible, because he hasn't actually written any code that's generalized to any monad (e.g: Haskell's sequence, liftM2, and so forth).
That last part is trivial: Just put those generic function in a functor, that take a Monad module as a parameter. Assuming I got the functor syntax right (unlikely), it should look something like:
functor MonadUtils MONAD = struct
sequence : 'a MONAD.monad list -> 'a list MONAD.monad
(* and so on *)
end
functor MonadUtils (M : MONAD) = struct
(* type annotations not strictly necessary *)
fun sequence (ms : 'a M.monad list) : 'a list M.monad =
let fun mcons (elt, rest) = M.bnd elt (fn e => M.bnd rest (fn r => M.ret (e::r)))
in foldr mcons (M.ret []) ms
end
end