[Haskell-cafe] Re: rebinding >>= for restricted monads

David Roundy droundy at darcs.net
Sun Dec 17 16:10:49 EST 2006

On Sun, Dec 17, 2006 at 01:35:49PM -0500, Chung-chieh Shan wrote:
> David Roundy <droundy at darcs.net> wrote:
> > class WitnessMonad wm where
> >    (>>=) :: wm w w' a -> (a -> wm w' w'' b) -> wm w w'' b
> >    (>>)   :: wm w w' a -> wm w' w'' b -> wm w w'' b
> >    return :: a -> wm w w' a
> >    fail   :: String -> wm w w' a
> I suspect that you want "w" and "w'" to be the same type in the types of
> "return" and "fail".

You're right.  That was silly of me.

> Previous work:
> Atkey, Robert. 2006. Parameterised notions of computation. In MSFP 2006:
> Workshop on mathematically structured functional programming, ed. Conor
> McBride and Tarmo Uustalu. Electronic Workshops in Computing, British
> Computer Society.  http://homepages.inf.ed.ac.uk/ratkey/param-notions.pdf
> http://haskell.org/pipermail/haskell-cafe/2004-July/006448.html

Hmmm.  Those look interesting, but don't seem to address the question of
trying this in actual Haskell.  I don't see any reason why this overloading
wouldn't work, except for the inconvenience of having to lift and unlift
everything that's not in a fun monad.  Do you? Mightn't there be a way
around that issue?
David Roundy
Department of Physics
Oregon State University

More information about the Haskell-Cafe mailing list