On Tue, 25 Mar 2008, Ryan Ingram wrote:

settest :: S.Set Int
settest = runSetM $ do
   x <- mplus (mplus mzero (return 2)) (mplus (return 2) (return 3))
   return (x+3)
-- fromList [5,6]

What this does under the hood is treat the computation on each element of the
set separately, except at programmer-specified synchronization points where
the computation result is required to be a member of the Ord typeclass.

It's like working in the List monad mainly, collapsing duplicates from time to time, right?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to