Hello.

Given:

newtype Dist a = D {unD :: [(a,Int)]}

instance Monad Dist where
  return x = D [(x,1)]
  d >>= f  = D [(y,q*p) | (x,p) <- unD d, (y,q) <- unD (f x)]
  fail _   = D []


How would one change Dist to wrap an instance of the (Data.Edison.Set c a) 
typeclass so that the Monad instance could be implemented in terms of e.g. 
singleton, unionWith, empty, etc?


Thanks
Daniel
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to