Skip to content

Instantly share code, notes, and snippets.

View hrb90's full-sized avatar

Harrison Brown hrb90

View GitHub Profile
@hrb90
hrb90 / ProfunctorLens.js
Last active November 15, 2017 21:20 — forked from tel/ProfunctorLens.js
Pure Profunctor Lenses in ES6
/**
* Lens types.
* ===========
*
* a * b = {fst: a, snd: b}
* a + b = {index: Boolean, value: a | b}
*
* Iso s t a b = forall (~>) . Profunctor (~>) => (a ~> b) -> (s ~> t)
* Lens s t a b = forall (~>) . Strong (~>) => (a ~> b) -> (s ~> t)
* Prism s t a b = forall (~>) . Choice (~>) => (a ~> b) -> (s ~> t)