Skip to content

Commit 6dd936b

Browse files
committed
filter by expr type
1 parent 04236a4 commit 6dd936b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/alacarte/src/app.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Functor,
99
interpreterFor,
1010
inject,
11+
supTypeSameAs,
1112
} from 'alacarte.js'
1213

1314
const compose = f => g => x=> f(g(x))
@@ -87,12 +88,12 @@ const CounterView = props => (
8788
CounterView.defaultProps = { count: 0 };
8889

8990
const counterable = connect((intent$) => {
90-
return {
91-
sink$: intent$.tap(compose(console.log)(interpretExpr(printer)))
92-
.map(interpretExpr(interpreter)),
93-
inc: () => over(lit('count'), add(lit(1))),
94-
dec: () => over(lit('count'), add(lit(-1))),
95-
}
91+
return {
92+
sink$: intent$.filter(supTypeSameAs(injector)).tap(compose(console.log)(interpretExpr(printer)))
93+
.map(interpretExpr(interpreter)),
94+
inc: () => over(lit('count'), add(lit(1))),
95+
dec: () => injectOver(injectorFrom([functorLit, functorOver]))(lit('count'), add(lit(-1)))
96+
}
9697
})
9798

9899
const Counter = counterable(CounterView)

0 commit comments

Comments
 (0)