[Haskell-cafe] Set monad

Andrea Vezzosi sanzhiyan at gmail.com
Sun Jan 9 13:36:35 CET 2011


On Sun, Jan 9, 2011 at 7:45 AM, Sebastian Fischer <fischer at nii.ac.jp> wrote:
> [...]
> Only conversion to the underlying Set type requires an Ord constraint.
>     getSet :: Ord a => Set a -> S.Set a
>     getSet a = a >>- S.singleton

this unfortunately also means that duplicated elements only get
filtered out at the points where you use getSet,
so in "getSet ((return 1 `mplus` return 1) >>= k)" k gets still called twice



More information about the Haskell-Cafe mailing list