Closed SimonRichardson closed 10 years ago
Overall, +1! But regarding $kleisli
, isn't this usually defined (at least in Haskell) as
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
and so shouldn't
$kleisli (x, y, z) > a
desugar into
x(a).chain(y).chain(z)
rather than
a.chain(x).chain(y).chain(z)
?
@markandrus You are indeed correct, I did start off doing that way but got inspired by $ap
and ended up breaking the original implementation. I've gone back to using >=>
as we can't do what $ap
is doing, which was using the ,
as a scalar repeat. In turn fixing the implementation.
Glad you reviewed the code!
I wonder if using >=>
as a repeating scalar should be allowed in sweet.js?
Also added
$kleisli
, ideally I would have liked to use infix operators, but this currently isn't supported by sweet.js. So I used the same idea as$ap
for it.