Sharing
Opened this issue · 1 comments
bmsherman commented
let x = pi in x + x
doesn't reuse work in the shared computation of pi
. It reduces to pi + pi
, which is
proc () -> do
x1 <- pi -< ()
x2 <- pi -< ()
(+) -< (x1, x2)
whereas we would prefer
proc () -> do
x <- pi -< ()
(+) -< (x, x)
I'm not sure how we can do that.
bmsherman commented
Partial but imperfect solution: https://github.com/psg-mit/micromarshall/blob/e8d86f2a75c89e51a0031f71265ae9327854d09f/src/Expr.hs#L81-L85