
Nathan Hüsken
If I double use an arrow (in this example a wire from netwire) like this:
objectWire :: WireP [Collision] Object objectWire = (Object <$> integral_ initPos) . speedWire <*> speedWire
will it be double evaluated, or can the compiler optimize this to evaluate speedWire only once?
It will be double-evaluated. To prevent this you can use the Arrow interface: proc x' -> do x <- speedWire -< x' {- ... use x ... -} However, in WireP it's guaranteed that you get the same result, so for code conciseness you can still have speedWire twice, if sacrificing some speed is not too big an issue. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad.