A monad to support computations which consume values from a (possibly infinite) supply.
Please let me know if there is any issue with the licensing or copyright — I am assuming that, because the code appears on the HaskellWiki pages, it follows the Simple license found there, and that packaging it in this way is not a problem.
I pulled this more or less verbatim from the HaskellWiki, since I wanted it on Hackage for distribution purposes:
http://www.haskell.org/haskellwiki/New_monads/MonadSupply
Some stuff was added, like a monoid instance and various helper functions.
This library is based on code found on the HaskellWiki, and subject to the
license found there:
http://www.haskell.org/haskellwiki/HaskellWiki:Copyrights
Permission is hereby granted, free of charge, to any person obtaining this
work (the "Work"), to deal in the Work without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Work, and to permit
persons to whom the Work is furnished to do so.
THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN
THE WORK.