Skip to content

Integrate with returns library #9

@zinthose

Description

@zinthose

Why it's good:

returns (specifically its monadic types like Result, Option, Either) is a natural fit for the "Functional Core." Pure functions often need to handle cases where an operation might fail (e.g., division by zero, item not found) or return an optional value. returns provides a robust, functional way to represent and propagate these outcomes without resorting to exceptions or None checks, keeping the core pure and composable.

Thoughts:

  • Provide examples of how a pureshell 'Ruleset' method could return a 'Result' or 'Option' type, and how the Shell would then bind or map over these results, or handle the 'Failure' case.
  • Provide convenience decorators or methods within pureshell to facilitate working with returns types if you see common patterns emerge in the Shell's interaction with Result types. For example, a Shell method that automatically unwraps a Result or handles an Err and updates state accordingly.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions