Skip to content

Instantly share code, notes, and snippets.

@DrBoolean
Created July 20, 2017 16:43
Show Gist options
  • Save DrBoolean/1d7b1b43966707fb2a050815ddbe523a to your computer and use it in GitHub Desktop.
Save DrBoolean/1d7b1b43966707fb2a050815ddbe523a to your computer and use it in GitHub Desktop.
rep4
const Id = x =>
({
 x,
 map: f => Id(f(x))
})
// to :: Id a -> (() -> a)
const to = ({x}) => () => x
// from :: (() -> a) -> Id a
const from = f => Id(f())
from(to(Id(‘hi’))) // Id(‘hi’)
to(from(() => ‘hi’)) // () => ‘hi’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment