[Haskell-cafe] Monad for Set?
haskell at brecknell.org
Tue Aug 7 00:07:50 EDT 2007
> I'm pondering, is it possible to define a Set monad analogous to the
> List monad?
> This leads me think of a different solution: What if I could define a
> Set monad that's smart enough to "know", for any type a, whether or
> not (Eq a) holds, and degenerate to a blind list if the elements can't
> be equated. Ultimately, what I would need is a way to overload "join"
> (or "bind") with two different implementations, one for types that
> satisfy (Eq a), and another implementation for all other types.
You might find this interesting, in case you haven't yet seen it:
If you also read the rest of that thread, you'll see that with a recent
GHC HEAD, you should be able to avoid the need for the Teq witness.
More information about the Haskell-Cafe