Closed louispan closed 8 years ago
Hi Louis, I think that this is the intended behaviour in THAT example. To have what you intend, it is a matter of using applicative :
total=(*) <$> getEvent "qantitity" <*> getEvent "price"
In this case, the total is calculated either a new quantity or price arrives
The monad is sequential, while the applicative execute the two event getters in parallel
But in this concrete example the monadic case is the appropriate. But hmmm I see that price should be before quantity because it does not make sense when a new price per unit arrives to calculate a total with the last quantity of product sold since that quantity corresponded to the old price, it should be with a new quantity.
I'm not sure if this is the right place to submit this issue, but I notice that the
profits
example on fpcomplete require a finalprice
event in theeventList
in order to print out thetotal
.For example, if I changed the
eventList
toThe the output is
That is, there is no final
total=90
emitted.Is this the expected behaviour?