
Nathan Hüsken
Let me simplify the example:
testW1 :: WireP () Double testW1 = pure 1.0
testW2 :: WireP () Double testW2 = 1.0
main = do let (res, _) = stepWire 1.0 () testW putStrLn $ show res
(set testW to testW1 or testW2). When I test this with testW=testW2 I see that "fromRational" is called which converts a Rational (=Ration Integer) to a WireP () Double (I tested this by adding a "trace" to the fromRational Control/Wire/Classes.hs). This means the "1.0" is converted to a Rational and then back to a WireP () Double, correct?
That's incorrect. There is absolutely no difference between the two except perhaps some RULE pragmas might apply. Let me elaborate. For Wire the 'fromRational' function is defined like this: fromRational = pure . fromRational Then the following holds: -- Using Double's Fractional instance: pure 1.0 = pure (fromRational (1 % 1)) -- Using Wire's Fractional instance: 1.0 = (pure . fromRational) (1 % 1) = pure (fromRational (1 % 1)) 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.