Puzzling (to me) type error message

getCurrentTime
I'm trying out concurrent haskell (never mind that the code isn't actually very concurrent - I'm just trying to get things to compile first). So with the following code, I get: play_move :: IORef Game_state -> IO () play_move game_state_ior = do (_, state, _) <- readIORef game_state_ior putStr "Playing AI: " start_time <- getCurrentTime ai_in_channel <- newChan ai_out_channel <- newChan writeChan ai_in_channel state ai_thread_id <- forkIO (run_ai ai_in_channel ai_out_channel) move <- readChan ai_out_channel end_time <- move `seq` (modifyIORef game_state_ior $! update_interactive_from_move move) putStrLn $ show $ (diffUTCTime end_time start_time) run_ai :: Chan Non_interactive_state -> Chan Move.Move -> IO () run_ai in_channel out_channel = do state <- readChan in_channel let move = recommended_move state writeChan out_channel move UI.hs:625:45: Not in scope: type constructor or class `Move.Move' If I then comment-out the type signature for run_ai, it compiles fine with the following warning message: UI.hs:626:0: Warning: Definition but no type signature for `run_ai' Inferred type: run_ai :: Chan Non_interactive_state -> Chan Move.Move -> IO () Ghc 6.10.1 on Mac OS X. What is going on?

2009/3/24 Colin Adams
UI.hs:625:45: Not in scope: type constructor or class `Move.Move'
If I then comment-out the type signature for run_ai, it compiles fine with the following warning message:
UI.hs:626:0: Warning: Definition but no type signature for `run_ai' Inferred type: run_ai :: Chan Non_interactive_state -> Chan Move.Move -> IO ()
Have you actually imported the Move.Move type? GHC /can/ suggest a type signature that includes type constructors that you haven't imported, but which show up in e.g. the types of imported functions. Cheers, Max

Oh, I see.
I assumed that is was being re-exported by one of the other imports
and was being pulled in like that.
I added an explicit import for the type and it now compiles the signature.
Thanks.
2009/3/24 Max Bolingbroke
2009/3/24 Colin Adams
: UI.hs:625:45: Not in scope: type constructor or class `Move.Move'
If I then comment-out the type signature for run_ai, it compiles fine with the following warning message:
UI.hs:626:0: Warning: Definition but no type signature for `run_ai' Inferred type: run_ai :: Chan Non_interactive_state -> Chan Move.Move -> IO ()
Have you actually imported the Move.Move type? GHC /can/ suggest a type signature that includes type constructors that you haven't imported, but which show up in e.g. the types of imported functions.
Cheers, Max
participants (2)
-
Colin Adams
-
Max Bolingbroke