machobearstudio / hyperlane

Context-dependent computation pipelines
Apache License 2.0
24 stars 13 forks source link

Edge case bug with lifted functions in flows #5

Closed navbruce closed 6 years ago

navbruce commented 6 years ago

Only the chain line changes:

import { lift, chain } from 'hyperlane'

const ar = [ 'a', 'b', 'c']
const peek = lift(x => {console.log(x); return x})
chain(peek, peek, peek)(ar)

(produces no output)

import { lift, chain } from 'hyperlane'

const ar = [ 'a', 'b', 'c']
const peek = lift(x => {console.log(x); return x})
chain(peek(), peek, peek)(ar)

[ 'a', 'b', 'c' ] [ 'a', 'b', 'c' ] [ 'a', 'b', 'c' ]

import { lift, chain } from 'hyperlane'

const ar = [ 'a', 'b', 'c']
const peek = lift(x => {console.log(x); return x})
chain(peek, peek(), peek)(ar)

[Function] [Function]

acvos commented 6 years ago

nice catch!.. This inconsistency have been bugging me for a while, but I wasn't able to quite narrow it down to a simple test case

acvos commented 6 years ago

Should be fixed

navbruce commented 6 years ago

Looks good