On 3/28/08, Dan Weston <[EMAIL PROTECTED]> wrote: > I'm having trouble embedding unconstrained monads into the NewMonad:
> Is there some trick (e.g. newtype boxing/unboxing) to get all the > unconstrained monads automatically instanced? Then the do notation could > be presumably remapped to the new class structure. The usual trick here is to use newtypes. (Yes, it sucks) > newtype OldMonad m = OldMonad m > unwrapMonad :: OldMonad m -> m > unwrapMonad (OldMonad m) = m > instance Monad m => Suitable (OldMonad m) v where > data Constraints (OldMonad m) v = NoConstraints > constraints _ = NoConstraints > instance Monad m => NewMonad (OldMonad m) where > newReturn = OldMonad . return > newBind x k = OldMonad $ unwrapMonad x >>= unwrapMonad . k _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe