request
Source: /nix/store/mls72plk3raskl1r5afh3cl9ik3rn969-source/nix/request.nix
Module Description
Ability request mechanism
Combinators
request
Requests an ability by name from the context.
This is the primary mechanism for invoking capabilities. The context must provide an attribute with the given name, which should be a function (ability) that handles the input and returns an effect.
Type Signature
String -> Input -> Fx<{name: Input -> Fx<S,O>}, O>
Parameters
name: Name of the ability to invokeinput: Input to pass to the ability
Example
runFx (
provide { double = x: pure (x * 2); }
(request "double" 21)
) # => 42
How It Works
- Creates a pending effect
- When evaluated, extracts the ability from context by name
- Calls the ability with the input
- Returns the ability’s result
Notes
Abilities are effectful handlers - they receive input and return
effects. For pure functions, use arrow.request instead.
See Also
arrow.request- For pure functions in contextprovide- Supplies abilities to effects
Generated from /nix/store/mls72plk3raskl1r5afh3cl9ik3rn969-source/nix/request.nix