[Haskell-cafe] Adding Ord constraint to instance Monad Set?
wolfgang at jeltsch.net
Wed Mar 31 09:37:10 EST 2004
Am Mittwoch, 31. März 2004 09:32 schrieben Sie:
> On Wed, Mar 31, 2004 at 08:48:35AM +0200, Wolfgang Jeltsch wrote:
> > > Now, as i think a little more about it, i believe what you want to do
> > > makes no sense. The monad operation '>>=' works on monads over
> > > *different* 'element' (i.e. argument) types (look at the type of
> > > '>>='). Your implementation only works if argument types are the same.
> > > I can't see how this can be generalized to different argument types
> > > even if both are instances of class Ord.
> > I disagree. AFAICS, his implementation also works with different element
> > types. Am I overlooking something?
> I think the real issue is that you can't restrict the types on which
> monad operates without modifying the Monad class.
Exactly. You would be able to define a meaningful Monad instance for Set if
Monad would have an Ord restriction on its "element" types. But since Monad
doesn't have this restriction, you cannot make a meaningful Monad instance of
More information about the Haskell-Cafe