質問していい?
以下のモナドのなかで、union は Ord a であるところの Set a にしか使えません、と怒られるんだが、どこで制約課したらいいの?

---------------------------------------------------------------------------
import qualified Data.Set as S

data Distribution a =
Dist { sample :: a, support :: (S.Set a), expectation :: ((a -> Double) -> Double) }

always :: a -> Distribution a
always x = Dist { sample = x, support = S.singleton x, expectation = \f -> f x }

newtype Probability a = Prob { runProbability :: Distribution a }

instance Monad Probability where

  p >>= f =

    let x = runProbability p in

    Prob $ Dist { sample = sample $ runProbability $ f (sample x),

             support = S.fold (\d -> S.union $ support (runProbability $ f d)) (S.empty) (support x),

             expectation = \g -> (expectation x) (\x -> (expectation (runProbability $ f x)) g) }

  return a = Prob $ always a

----------------------------------------------------------------------------
Could not deduce (Ord b) from the context ()
arising from a use of `S.union'
Possible fix:  add (Ord b) to the context of the type signature for `>>='