Liking cljdoc? Tell your friends :D

hive-dsl.result.spec

clojure.spec contracts for the Result monad.

Applies type-theoretic best practices via spec:

  • Sum types: Result = Ok | Err (discriminated union via :ok/:error keys)
  • Smart constructors: ok/err are the only valid constructors
  • Making illegal states unrepresentable: a Result is EITHER ok? OR err?, never both
  • Totality: all functions are total (never throw)
  • Functor/Monad laws enforced by property tests

References:

  • Wlaschin: Domain Modeling Made Functional (algebraic types, smart constructors)
  • Brady: Type-Driven Development (type-define-refine, totality)
  • Uncle Bob: Functional Design Ch10 (spec = best of static + dynamic)
  • clojure.org/guides/spec
clojure.spec contracts for the Result monad.

Applies type-theoretic best practices via spec:
- Sum types: Result = Ok | Err (discriminated union via :ok/:error keys)
- Smart constructors: ok/err are the only valid constructors
- Making illegal states unrepresentable: a Result is EITHER ok? OR err?, never both
- Totality: all functions are total (never throw)
- Functor/Monad laws enforced by property tests

References:
- Wlaschin: Domain Modeling Made Functional (algebraic types, smart constructors)
- Brady: Type-Driven Development (type-define-refine, totality)
- Uncle Bob: Functional Design Ch10 (spec = best of static + dynamic)
- clojure.org/guides/spec
raw docstring

instrument!clj

(instrument!)

Enable spec checking on all Result DSL functions. Use in dev/test, not production (performance cost). Note: macros (let-ok, try-effect, try-effect*) have fdef specs but cannot be instrumented (compile-time expansion).

Enable spec checking on all Result DSL functions.
Use in dev/test, not production (performance cost).
Note: macros (let-ok, try-effect, try-effect*) have fdef specs
but cannot be instrumented (compile-time expansion).
sourceraw docstring

unstrument!clj

(unstrument!)

Disable spec checking (restore production performance).

Disable spec checking (restore production performance).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close