Functional reactive programming library
#14ArrowChoice `left` and `right` inhibit other side of Either, unlike `arr id +++` / `+++ arr id`
I may be misled by the default implementation of f +++ g
which is left f >>> right g
, but I thought that left
should pass through a Right
unaltered and the same but in reverse for right
/ Left
. However, Wire's ArrowChoice
doesn't do this:
type MyWire = Wire (Timed Int ()) () IO (Either Int Text) (Either Int Text)
let check (wire :: MyWire) = fst <$> stepWire wire (Timed 0 ()) (Right (Left 123))
let lwire = arr ((+) 123)
let rwire = arr ("foo" <>)
check (right rwire >>> left lwire) -- gives: Left ()
check (left lwire >>> right rwire) -- gives: Left ()
check (lwire +++ rwire) -- gives: Right (Left 246)
I can just rewrite right f
to arr id +++ f
to get it to stop inhibiting, but this behavior seems wrong.