streams-3.3: 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

data Supply a Source #

Instances

Functor Supply Source # 

Methods

fmap :: (a -> b) -> Supply a -> Supply b #

(<$) :: a -> Supply b -> Supply a #

Applicative Supply Source # 

Methods

pure :: a -> Supply a #

(<*>) :: Supply (a -> b) -> Supply a -> Supply b #

(*>) :: Supply a -> Supply b -> Supply b #

(<*) :: Supply a -> Supply b -> Supply a #

Foldable Supply Source # 

Methods

fold :: Monoid m => Supply m -> m #

foldMap :: Monoid m => (a -> m) -> Supply a -> m #

foldr :: (a -> b -> b) -> b -> Supply a -> b #

foldr' :: (a -> b -> b) -> b -> Supply a -> b #

foldl :: (b -> a -> b) -> b -> Supply a -> b #

foldl' :: (b -> a -> b) -> b -> Supply a -> b #

foldr1 :: (a -> a -> a) -> Supply a -> a #

foldl1 :: (a -> a -> a) -> Supply a -> a #

toList :: Supply a -> [a] #

null :: Supply a -> Bool #

length :: Supply a -> Int #

elem :: Eq a => a -> Supply a -> Bool #

maximum :: Ord a => Supply a -> a #

minimum :: Ord a => Supply a -> a #

sum :: Num a => Supply a -> a #

product :: Num a => Supply a -> a #

Traversable Supply Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Supply a -> f (Supply b) #

sequenceA :: Applicative f => Supply (f a) -> f (Supply a) #

mapM :: Monad m => (a -> m b) -> Supply a -> m (Supply b) #

sequence :: Monad m => Supply (m a) -> m (Supply a) #

Comonad Supply Source # 

Methods

extract :: Supply a -> a #

duplicate :: Supply a -> Supply (Supply a) #

extend :: (Supply a -> b) -> Supply a -> Supply b #

Traversable1 Supply Source # 

Methods

traverse1 :: Apply f => (a -> f b) -> Supply a -> f (Supply b) #

sequence1 :: Apply f => Supply (f b) -> f (Supply b) #

Apply Supply Source # 

Methods

(<.>) :: Supply (a -> b) -> Supply a -> Supply b #

(.>) :: Supply a -> Supply b -> Supply b #

(<.) :: Supply a -> Supply b -> Supply a #

Extend Supply Source # 

Methods

duplicated :: Supply a -> Supply (Supply a) #

extended :: (Supply a -> b) -> Supply a -> Supply b #

Foldable1 Supply Source # 

Methods

fold1 :: Semigroup m => Supply m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Supply a -> m #

Eq a => Eq (Supply a) Source # 

Methods

(==) :: Supply a -> Supply a -> Bool #

(/=) :: Supply a -> Supply a -> Bool #

Data a => Data (Supply a) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Supply a -> c (Supply a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Supply a) #

toConstr :: Supply a -> Constr #

dataTypeOf :: Supply a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Supply a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Supply a)) #

gmapT :: (forall b. Data b => b -> b) -> Supply a -> Supply a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Supply a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Supply a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Supply a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Supply a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Supply a -> m (Supply a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Supply a -> m (Supply a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Supply a -> m (Supply a) #

Ord a => Ord (Supply a) Source # 

Methods

compare :: Supply a -> Supply a -> Ordering #

(<) :: Supply a -> Supply a -> Bool #

(<=) :: Supply a -> Supply a -> Bool #

(>) :: Supply a -> Supply a -> Bool #

(>=) :: Supply a -> Supply a -> Bool #

max :: Supply a -> Supply a -> Supply a #

min :: Supply a -> Supply a -> Supply a #

Read a => Read (Supply a) Source # 
Show a => Show (Supply a) Source # 

Methods

showsPrec :: Int -> Supply a -> ShowS #

show :: Supply a -> String #

showList :: [Supply a] -> ShowS #

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

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

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