Skip to content

Instantly share code, notes, and snippets.

@luxbock
Created July 15, 2016 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luxbock/43834bb24d9b0a560229c7e24bcc3cd5 to your computer and use it in GitHub Desktop.
Save luxbock/43834bb24d9b0a560229c7e24bcc3cd5 to your computer and use it in GitHub Desktop.
(defn map-left
[f e]
(if (e/right? e)
e
(e/left (f (m/extract e)))))
(map-left #(assoc % :a a)
(with-monad e/context
(mlet [foo (compute-foo a b)
bar (compute-bar foo c)]
(m/return (foobar foo bar)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment