[GHC] #13893: Improved Help for Control.Concurrent and Control.Exception when "variable not in scope"

GHC ghc-devs at haskell.org
Wed Jun 28 16:11:58 UTC 2017


#13893: Improved Help for Control.Concurrent and Control.Exception when "variable
not in scope"
-------------------------------------+-------------------------------------
           Reporter:  vanto          |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Poor/confusing
  Unknown/Multiple                   |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The piece of code that bgamari wrote in {{{#13891}}} is interesting from
 the point of view of the error messages.\\

 {{{
 main = do
     putStrLn "forking"
     forkIO $ bracket (putStrLn "forked") (const $ putStrLn "finalize")
 (const $ putStrLn "hello" >> threadDelay 100000000)
     threadDelay 10000
     putStrLn "done"
 }}}
 When the imports are not written GHC answers.\\

 {{{
 Prelude> :l testfork
 [1 of 1] Compiling Main             ( testfork.hs, interpreted )

 testfork.hs:6:5: error:
     Variable not in scope: forkIO :: t0 -> IO a0

 testfork.hs:6:14: error:
     Variable not in scope:
       bracket :: IO () -> (b1 -> IO ()) -> (b0 -> IO b2) -> t0

 testfork.hs:6:101: error:
     Variable not in scope: threadDelay :: Integer -> IO b2

 testfork.hs:7:5: error:
     Variable not in scope: threadDelay :: Integer -> IO a1
 Failed, modules loaded: none.
 Prelude>
 }}}
 It would be advisable to complete by:\\
 {{{Perhaps you intended to import Control.Concurrent}}} for {{{forkIO}}}
 and {{{threadDelay}}}.\\

 {{{Perhaps you intended to import Control.Exception}}} for
 {{{bracket}}}.\\
 I hope you have a way to write it once for all the variables involved.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13893>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list