Monday, March 13, 2006

monad fail test

There appears to be no generic way to test if the value of a monad is (fail).

(: combine-maybes-in-io :fun :context((Monad io)) (io(Maybe(a))) ((l-to-do(:list(io(Maybe(a)))))) (:case l-to-do ((:nil)(return Nothing)) ((:cons(h)(rest)) (:do (:= value h) (:case value ((Just(_))(return value)) ((_)(combine-maybes-in-io rest)) ))) ) )

No comments :