I have just started using netwire and I'm having trouble with the very basics.
The following code works fine for me:
main :: IO ()
main = testWire clockSession_ (for 3 . yeah)
yeah :: Monad m => Wire s () m a String
yeah = pure "yes"
But this does not:
main :: IO ()
main = testWire clockSession_ forYeah
forYeah :: (Show b, Show e) => Wire s e Identity a b
forYeah = for 3 . yeah
fails with error:
Could not deduce (b ~ [Char])
from the context (Show b, Show e)
bound by the type signature for
forYeah :: (Show b, Show e) => Wire s e Identity a b
at /home/fiendfan1/workspace/Haskell/Haskell-OpenGL/src/Main.hs:12:12-54
`b' is a rigid type variable bound by
the type signature for
forYeah :: (Show b, Show e) => Wire s e Identity a b
at /home/fiendfan1/workspace/Haskell/Haskell-OpenGL/src/Main.hs:12:12
Expected type: Wire s e Identity a b
Actual type: Wire s () Identity a String
In the second argument of `(.)', namely `yeah'
In the expression: for 3 . yeah
In an equation for `forYeah': forYeah = for 3 . yeah
So I changed it to:
forYeah :: Show e => Wire s e Identity a String
which gives me the error:
Could not deduce (e ~ ())
from the context (Show e)
bound by the type signature for
forYeah :: Show e => Wire s e Identity a String
at /home/fiendfan1/workspace/Haskell/Haskell-OpenGL/src/Main.hs:12:12-49
`e' is a rigid type variable bound by
the type signature for
forYeah :: Show e => Wire s e Identity a String
at /home/fiendfan1/workspace/Haskell/Haskell-OpenGL/src/Main.hs:12:12
Expected type: Wire s e Identity a String
Actual type: Wire s () Identity a String
In the second argument of `(.)', namely `yeah'
In the expression: for 3 . yeah
In an equation for `forYeah': forYeah = for 3 . yeah
Changing it to:
forYeah :: Wire s () Identity a String
Gives the following error:
No instance for (HasTime Integer s) arising from a use of `for'
Possible fix: add an instance declaration for (HasTime Integer s)
In the first argument of `(.)', namely `for 3'
In the expression: for 3 . yeah
In an equation for `forYeah': forYeah = for 3 . yeah
Can someone explain why this happens and how I can fix my second code example?