why is Data.Set not a Monad?

Daniel Franke nonce+haskell.org at dfranke.us
Mon May 7 00:23:20 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, May 07, 2007 at 04:56:35AM +0100, Frederik Eaton wrote:
> I guess I'd thought that the primary use of Set would be to replace
> lists for applications where order doesn't matter, or maybe where an
> efficient 'union' is needed; but many of these (e.g. parsing) commonly
> use a monadic interface, so it seems strange for Set not to have one.

A reasonably elegant solution might be to use StateT, with the contents
of the set as your state.

- -- 
 Daniel Franke         df at dfranke.us         http://www.dfranke.us
 |----| =|\     \\\\    
 || * | -|-\---------   Man is free at the instant he wants to be. 
 -----| =|  \   ///     --Voltaire
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGPqm3KTA17JAC/eYRAgklAJ0bmOM/1MkmCZiEb0BM/RXclqGpPACgyKg+
FvI7/vT3d1lTJ1ZHoqwPa2U=
=e/Y8
-----END PGP SIGNATURE-----


More information about the Libraries mailing list