streams-3.2.1: Various Haskell 2010 stream comonads

Copyright(C) 2008-2011 Edward Kmett, (C) 2008 Iavor S. Diatchki
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell98

Data.Stream.Supply

Description

This library can be used to generate values (for example, new names) without the need to thread state. This means that functions that need to generate new values only need a supply object as an argument, and they do not need to return a new supply object as a result. This decreases the number of data-dependencies in a program, which makes it easier to exploit parallelism.

The technique for generating new values is based on the paper ''On Generating Unique Names'' by Lennart Augustsson, Mikael Rittri, and Dan Synek.

Documentation

newSupply :: (a -> a) -> a -> IO (Supply a)

newDupableSupply :: (a -> a) -> a -> IO (Supply a)

splits :: Integral b => Supply a -> b -> Supply a

split2 :: Supply a -> (Supply a, Supply a)

split3 :: Supply a -> (Supply a, Supply a, Supply a)

split4 :: Supply a -> (Supply a, Supply a, Supply a, Supply a)