Wolfgang Jeltsch pushed to branch wip/jeltsch/system-io-uncovering at Glasgow Haskell Compiler / GHC Commits: 2138e856 by Wolfgang Jeltsch at 2026-02-25T15:47:55+02:00 Tighten the dependencies of `GHC.Internal.TH.Monad` - - - - - 1 changed file: - libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs Changes: ===================================== libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs ===================================== @@ -32,7 +32,6 @@ import Control.Monad.Fix (MonadFix (..)) import Control.Exception (BlockedIndefinitelyOnMVar (..), catch, throwIO) import Control.Exception.Base (FixIOException (..)) import Control.Concurrent.MVar (newEmptyMVar, readMVar, putMVar) -import System.IO ( hPutStrLn, stderr ) import qualified Data.Kind as Kind (Type) import GHC.IO.Unsafe ( unsafeDupableInterleaveIO ) import GHC.Types (TYPE, RuntimeRep(..)) @@ -41,7 +40,6 @@ import GHC.Internal.Base hiding (NonEmpty(..),Type, Module, sequence) import GHC.Internal.Data.Data hiding (Fixity(..)) import GHC.Internal.Data.Traversable import GHC.Internal.IORef -import GHC.Internal.System.IO import GHC.Internal.Data.Foldable import GHC.Internal.Data.Typeable import GHC.Internal.Control.Monad.IO.Class @@ -54,6 +52,10 @@ import GHC.Internal.MVar import GHC.Internal.IO.Exception import qualified GHC.Internal.Types as Kind (Type) #endif +import GHC.Internal.IO (FilePath) +import GHC.Internal.IO.Handle.Text (hPutStr, hPutStrLn) +import GHC.Internal.IO.IOMode (IOMode (WriteMode)) +import GHC.Internal.IO.StdHandles (stderr, withFile) import GHC.Internal.ForeignSrcLang import GHC.Internal.LanguageExtensions import GHC.Internal.TH.Syntax @@ -875,6 +877,15 @@ addForeignSource lang src = do path <- addTempFile suffix runIO $ writeFile path src addForeignFilePath lang path + where + + {- + This is a copy of the implementation of 'System.IO.writeFile', which we + use to avoid forcing 'System.IO.writeFile' being implemented in + @ghc-internal@. + -} + writeFile :: FilePath -> String -> IO () + writeFile f txt = withFile f WriteMode (\ hdl -> hPutStr hdl txt) -- | Same as 'addForeignSource', but expects to receive a path pointing to the -- foreign file instead of a 'String' of its contents. Consider using this in View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2138e856f8d96df727bd3919be7af6a8... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2138e856f8d96df727bd3919be7af6a8... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Wolfgang Jeltsch (@jeltsch)