[Haskell-cafe] a problem defining a monad instance
dagit at codersbase.com
Fri Nov 6 14:15:44 EST 2009
On Fri, Nov 6, 2009 at 10:19 AM, Neil Brown <nccb2 at kent.ac.uk> wrote:
> 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.
> Is there some way around? Either to somehow define the monad, or to
> achieve the same functionality without using Map, which requires Ord
> Not being allowed constraints on the variables for class methods is
> probably the problem I have most frequently run into recently in Haskell (is
> there any way to fix this, or does it open up a whole can of worms?).
I believe this paper is intended to propose a solution:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe