[Haskell-cafe] a problem defining a monad instance
jake.mcarthur at gmail.com
Fri Nov 6 14:36:41 EST 2009
Petr Pudlak wrote:
> The problem is the (Ord b) condition, which is required for the Map
> functions. When I try to define the monad instance as
>> instance Monad Distrib where
>> return = dreturn
>> (>>=) = dcompose
> obviously, I get an error at (>>=):
> Could not deduce (Ord b) from the context.
This is the same reason we do not have e.g. a Monad instance for Set.
One solution is a concept of "restricted" monads, and one implementation
of restricted monads is given here:
More information about the Haskell-Cafe