basic.nix
Source: /nix/store/mls72plk3raskl1r5afh3cl9ik3rn969-source/nix/basic.nix
Module Description
Basic effect constructors for lifting values
Combinators
pure
Creates a pure (effect-free) value with no context requirements.
This is the simplest way to lift a plain value into the effect system.
The resulting effect is immediately available and requires no context.
Equivalent to immediate {}.
Type Signature
V -> Fx<{}, V>
Parameters
value: Any value to wrap in an effect
Example
pure 42 # => Fx<{}, Int>
pure "hello" # => Fx<{}, String>
runFx (pure 42) # => 42
See Also
value- Similar but preserves any context typeimmediate- Lower-level constructor used internally
value
Creates an effect that produces a value while preserving any context.
Unlike pure which requires empty context, value works polymorphically
over any context type. The context passes through unchanged.
Type Signature
V -> Fx<S, V> (for any S)
Parameters
v: The value to produce
Example
# Works in any context
provide { x = 1; } (value 42) # => 42
# Useful in sequencing when you need a constant
mapM (x: value (x * 2)) someEffect
See Also
pure- When you know context is emptyfunc- When value depends on state
Generated from /nix/store/mls72plk3raskl1r5afh3cl9ik3rn969-source/nix/basic.nix