Skip to content

Instantly share code, notes, and snippets.

@mattfenwick
mattfenwick / core.clj
Created April 1, 2013 15:45
Simple example of error monad in Clojure. Shows how monads -- which can be pure functions, in the non-side-effecting sense -- can help reduce tedious, boilerplate code.
(ns whatever.core)
(defn success
"create a successful monadic value"
[value]
{:status "success" :value value})
(defn failure
"create a failing monadic value"