Skip to content

Instantly share code, notes, and snippets.

@xaviervia
Created February 12, 2017 09:43
Show Gist options
  • Save xaviervia/0741efd3d71b5fa001b1de9629757609 to your computer and use it in GitHub Desktop.
Save xaviervia/0741efd3d71b5fa001b1de9629757609 to your computer and use it in GitHub Desktop.
2017-02-11
const c = directCell( x => console.log('a'))
c(1, 1) // nothing
c(1, 0) // 'a'
effect( next => cell( state => ).pipe(cell(x => y)) void ))
const a = Arrow( id )
a.product(a).product(a)([1, [2, 3]])
const a = cell( x => x + 1 )
const b = cell( console.log )
const c = a.product(b)
a([1, [2, Nothing]]) === 2
c([0, 1]) // logs nothing
c([0, undefined]) // logs 1
c([0, 1]) === [1]
c([0, undefined]) === 1
const d = cell( x => x * 2 )
const e = d.pipe(c)
e([1, undefined]) // logs nothing
e(1, 1, undefined) // logs 3
e(1, 2, 3) === [2, 3]
e(1, 1, undefined) === [2, 3]
1 2 3
\ \ \
d a b
const idCell = cell( x => x )
const idA = a.pipe(id)
a(1) [2]// => 2
idA(1) [2, 2]// => 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment