Am Mittwoch, 31. März 2004 03:11 schrieb Benjamin Franksen: > > instance Monad Set where > > m >>= k = concatSets (mapSet k m) > > return x = unitSet x > > fail s = emptySet > > > > concatSets sets = foldl union emptySet (setToList sets) > > instance (Eq b,Ord b) => Ord (Set b) where > > compare set1 set2 = compare (setToList set1) (setToList set2)> [...]
> [...] > 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? > [...] > Ben Wolfgang _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe