
On Sun, 22 Mar 2015 07:15:09 +0100 joachifm@fastmail.fm wrote:
On Sun, Mar 22, 2015, at 05:57 AM, briand@aracnet.com wrote:
The error message:
time.hs:13:8: No instance for (Show e0) arising from a use of ‘testWire’ The type variable ‘e0’ is ambiguous Note: there are several potential instances: instance Show Double -- Defined in ‘GHC.Float’ instance Show Float -- Defined in ‘GHC.Float’ instance (Integral a, Show a) => Show (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’ ...plus 45 others In the expression: testWire clockSession_ pos In an equation for ‘main’: main = testWire clockSession_ pos Failed, modules loaded: none.
The problem is that `testWire` wants to print the inhibition value but has no way of choosing which `Show` instance to use, because the type of `e` is left unspecified in your snippet. This is obvious if you look at the constraints on `testWire`, but not so obvious from the error message. The solution is to fix the inhibition type to `()` (or whatever).
I change the type of pos to pos :: (HasTime t s, Monad m) => Wire s () m a Float and that did it. Also, () could just be Float, or, as you were saying, whatever. Thank you, thank you ! Brian p.s. and for the record not my snippet, got it from a blog. i'm guessing it was untested...