Module

Supply

Package
purescript-supply
Repository
ajnsit/purescript-supply

#Supply Source

data Supply s a

A type that can be used to generate values on demand. s is a phantom type parameter that prevents unsafe usage

Constructors

Instances

#supplyValue Source

supplyValue :: forall a s. Supply s a -> a

Get the value of a supply. This function, together with

#split2 Source

split2 :: forall a s. Supply s a -> Tuple (Supply s a) (Supply s a)

Split a supply into two different supplies.

#split3 Source

split3 :: forall a s. Supply s a -> Tuple3 (Supply s a) (Supply s a) (Supply s a)

Split a supply into three different supplies.

#split4 Source

split4 :: forall a s. Supply s a -> Tuple4 (Supply s a) (Supply s a) (Supply s a) (Supply s a)

Split a supply into four different supplies.

#unsafeInterleaveEffect Source

unsafeInterleaveEffect :: forall a. Effect a -> Effect (Lazy a)

unsafeInterleaveEffect allows an Effect to be deferred lazily.

#newSupply Source

newSupply :: forall a s. a -> (a -> a) -> Effect (Supply s a)

Create a new supply

#withSupply Source

withSupply :: forall a r. a -> (a -> a) -> (forall s. Supply s a -> r) -> r

Create a new supply and use it without effects

#modifySupply Source

modifySupply :: forall b a s. Supply s a -> (Supply s a -> b) -> Supply s b

Generate a new supply by systematically applying a function

#newIntSupply Source

newIntSupply :: forall s. Effect (Supply s Int)

Create a new integer supply

#withIntSupply Source

withIntSupply :: forall r. (forall s. Supply s Int -> r) -> r

Create a new integer supply and use it without effects

Modules
Supply