Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 invoke
  • input: Input to pass to the ability

Example

runFx (
  provide { double = x: pure (x * 2); }
    (request "double" 21)
)  # => 42

How It Works

  1. Creates a pending effect
  2. When evaluated, extracts the ability from context by name
  3. Calls the ability with the input
  4. 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 context
  • provide - Supplies abilities to effects

Generated from /nix/store/mls72plk3raskl1r5afh3cl9ik3rn969-source/nix/request.nix