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 #

Instances
Functor Supply # 
Instance details

Defined in Data.Stream.Supply

Methods

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

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

Applicative Supply # 
Instance details

Defined in Data.Stream.Supply

Methods

pure :: a -> Supply a #

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

liftA2 :: (a -> b -> c) -> Supply a -> Supply b -> Supply c #

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

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

Foldable Supply # 
Instance details

Defined in Data.Stream.Supply

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 # 
Instance details

Defined in Data.Stream.Supply

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 # 
Instance details

Defined in Data.Stream.Supply

Methods

extract :: Supply a -> a #

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

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

Traversable1 Supply # 
Instance details

Defined in Data.Stream.Supply

Methods

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

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

Foldable1 Supply # 
Instance details

Defined in Data.Stream.Supply

Methods

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

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

toNonEmpty :: Supply a -> NonEmpty a #

Apply Supply # 
Instance details

Defined in Data.Stream.Supply

Methods

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

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

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

liftF2 :: (a -> b -> c) -> Supply a -> Supply b -> Supply c #

Extend Supply # 
Instance details

Defined in Data.Stream.Supply

Methods

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

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

Eq a => Eq (Supply a) # 
Instance details

Defined in Data.Stream.Supply

Methods

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

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

Data a => Data (Supply a) # 
Instance details

Defined in Data.Stream.Supply

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) # 
Instance details

Defined in Data.Stream.Supply

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) # 
Instance details

Defined in Data.Stream.Supply

Show a => Show (Supply a) # 
Instance details

Defined in Data.Stream.Supply

Methods

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

show :: Supply a -> String #

showList :: [Supply a] -> ShowS #

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

newNumSupply :: Num a => IO (Supply a) #

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

split :: Supply a -> Stream (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) #