I've noticed some suspicious code in base:GHC.IO.Encoding.
setLocaleEncoding, setFileSystemEncoding, setForeignEncoding ::
TextEncoding -> IO ()
(getLocaleEncoding, setLocaleEncoding) = mkGlobal initLocaleEncoding
(getFileSystemEncoding, setFileSystemEncoding) = mkGlobal
initFileSystemEncoding
(getForeignEncoding, setForeignEncoding) = mkGlobal
initForeignEncoding
mkGlobal :: a -> (IO a, a -> IO ())
mkGlobal x = unsafePerformIO $ do
x_ref <- newIORef x
return (readIORef x_ref, writeIORef x_ref)
I've not elided any pragmas and there's no relevant LANGUAGE or OPTIONS
pragmas.
With HEAD from a couple weeks ago, mkGlobal is not getting inlined. But
with some of my experimental alterations of sizeExpr, it is getting inlined.
So this code should probably have some of the guards for faking global
variables, right?
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs