[Haskell-cafe] AT solution: rebinding >>= for restricted monads
droundy at darcs.net
Tue Dec 19 09:34:43 EST 2006
On Mon, Dec 18, 2006 at 06:52:41PM -0800, Iavor Diatchki wrote:
> Hi David,
> I don't think you need functional dependencies or associated
> type synonyms to get your example to work. In the past,
> I have used the abstraction that you are describing (I call it
> an "indexed monad" and it has a nice categorical definition).
The trouble is that your solution doesn't allow you to use do-notation with
the IxMonad. And if you did allow yourself to use do-notation by rebinding
(>>=), etc, then you wouldn't be able to use ordinary monads with
do-notation in the same module. That's what makes things tricky, since an
IxMonad is different-kinded from Monad, so you can't make a monad an
instance of IxMonad.
More information about the Haskell-Cafe