
#12509: ghci -XSafe fails in an inscrutable way -------------------------------------+------------------------------------- Reporter: int-e | Owner: RolandSenn Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: SafeHaskell Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: make test | TEST=T12509 Blocked By: | Blocking: Related Tickets: #13385, #14342 | Differential Rev(s): Gitlab Merge Wiki Page: | Request 23 -------------------------------------+------------------------------------- Comment (by int-e): Following in RolandSenn's trail... `ghci` evaluates some code internally. One such piece of code comes from `ghc/GHCi/UI/Monad.hs`, `initInterpBuffering`, which evaluates `System.IO.hSetBuffering System.IO.stdin System.IO.NoBuffering` (and the same for `stdout` and `stderr`). This works fine without `-XSafe`, but with `-XSafe` there is a stricter check that requires `System.IO` to actually be imported: {{{ $ ghci GHCi, version 8.6.1: http://www.haskell.org/ghc/ :? for help Prelude> System.IO.hSetBuffering System.IO.stdin System.IO.NoBuffering Prelude> :set -XSafe Prelude> System.IO.hSetBuffering System.IO.stdin System.IO.NoBuffering <interactive>:3:1: error: Not in scope: ‘System.IO.hSetBuffering’ No module named ‘System.IO’ is imported. <interactive>:3:25: error: Not in scope: ‘System.IO.stdin’ No module named ‘System.IO’ is imported. <interactive>:3:41: error: Not in scope: data constructor ‘System.IO.NoBuffering’ No module named ‘System.IO’ is imported. Prelude> import System.IO Prelude System.IO> System.IO.hSetBuffering System.IO.stdin System.IO.NoBuffering Prelude System.IO> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12509#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler