On 2005-09-09, Frederik Eaton <frederik@a5.repetae.net> wrote:
I thought the easy answer would be to inject non-monadic values into the monad (assuming one already rejiggered things to do automatic lifting).
I don't know if this is the right way of looking at it. Do you have an example?
In a do block, 1 + [2,3,4] would get turned into liftM2 (+) (return 1) [2, 3, 4] (I actually think this whole thing is a horrible idea, much for the reasons Cale Gibbard puts forward.)
Would it mean treating the 'Monad' class specially? Perhaps, but I don't think this is a reason to avoid it. Further, it is likely that whatever is done to extend the type checker could be given a general interface, which Monad would simply take advantage of, using a meta-declaration in the same spirit as "infixr" etc.
Well, monads are already treated specially -- the whole do syntax. -- Aaron Denney -><-