Module

Data.Lazy

#Lazy

data Lazy t0

Lazy a represents lazily-computed values of type a.

A lazy value is computed at most once - the result is saved after the first computation, and subsequent attempts to read the value simply return the saved value.

Lazy values can be created with defer, or by using the provided type class instances.

Lazy values can be evaluated by using the force function.

purerl note: Due to the nature of the BEAM platform Lazy values are not in fact lazy with the Erlang backend, but simple thunks, i.e. will be recomputed each time they are required.

Instances

#defer

defer :: forall a. (Unit -> a) -> Lazy a

Defer a computation, creating a Lazy value.

#force

force :: forall a. Lazy a -> a

Force evaluation of a Lazy value.

Modules