arendsee / rmonad

Pipelines you can compute on
70 stars 0 forks source link

Missing connections #7

Open arendsee opened 6 years ago

arendsee commented 6 years ago

Binding a nested Rmonad into a funnel loses the nested nodes:

1 %>>% { . %>>% { . + 2 }} %>>% funnel(44) %>% size
#R> 4
1 %>>% { . %>>% { . + 2 }} %>% funnel(44) %*>% sum %>% size
#R> 6

The output value is still correct, just history is lost. The problem can be worked around by just using non-monadic piping (e.g. magrittr's %>%) instead of %>>%. But still, the nested graph should not be lost.

arendsee commented 6 years ago

funnel is working on the monad, not in the monad. So the %>>% operator should probably not be used (except in exotic cases). I could add a warning if the user tries to use funnel in this way.