[Haskell-cafe] netwire example error message

briand at aracnet.com briand at aracnet.com
Sun Mar 22 04:57:17 UTC 2015


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.


So here's my type debugging.  (netwire sure is convoluted)

pos => Wire s e m a Float

integral => a -> Wire s e m a a

clockSession_ => Session m (Timed NominalDiffTime ()) 

looks to me like the problem is probably rooted in the interaction of pos with (Timed NominalDiffTime) as it does not seem to have a float instance, but that doesn't seem like it should result in an error about ambiguity.

Any help appreciated.

Thanks
Brian

----

import Prelude hiding ((.)) -- To use (.) in the scope of Categories instead
import Control.Wire
import FRP.Netwire

speed :: Float
speed = 0.5

pos :: (HasTime t s, Monad m) => Wire s e m a Float
pos = integral 0 . pure speed

-- The main function
main :: IO ()
main = testWire clockSession_ pos


More information about the Haskell-Cafe mailing list