on master help sign in
Rename hDuplicateTo to hDuplicateTo' (#259)

We have some issues in GHCi on the DAML codebase where it complains about: <interactive>:28:1: error: Ambiguous occurrence `hDuplicateTo' It could refer to either `Development.IDE.GHC.Util.hDuplicateTo', imported from `Development.IDE.GHC.Util' at compiler/damlc/daml-opts/daml-opts/DA/Daml/Options.hs:36:1-31 or `GHC.IO.Handle.hDuplicateTo', imported from `GHC.IO.Handle' Given that this is only internal to ghcide anyway, we can just rename it.

commit0838dcbbd139e87b0f84165261982c82ca94fd08 authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org> dateMon 16 Dec 2019, 14:53 (7 years ago) parentfc30f14
2 files changed+6−6
src/Development/IDE/GHC/Util.hs+5−5 src/Development/IDE/LSP/LanguageServer.hs+1−1
src/Development/IDE/GHC/Util.hs+5−5
@@ -20,7 +20,7 @@ module Development.IDE.GHC.Util(
2020 moduleImportPath,
2121 HscEnvEq, hscEnv, newHscEnvEq,
2222 readFileUtf8,
23− hDuplicateTo,
23+ hDuplicateTo',
2424 cgGutsToCoreModule
2525 ) where
2626
@@ -167,8 +167,8 @@ cgGutsToCoreModule safeMode guts modDetails = CoreModule
167167
168168-- This is a slightly modified version of hDuplicateTo in GHC.
169169-- See the inline comment for more details.
170−hDuplicateTo :: Handle -> Handle -> IO ()
171−hDuplicateTo h1@(FileHandle path m1) h2@(FileHandle _ m2) = do
170+hDuplicateTo' :: Handle -> Handle -> IO ()
171+hDuplicateTo' h1@(FileHandle path m1) h2@(FileHandle _ m2) = do
172172 withHandle__' "hDuplicateTo" h2 m2 $ \h2_ -> do
173173 -- The implementation in base has this call to hClose_help.
174174 -- _ <- hClose_help h2_
@@ -181,7 +181,7 @@ hDuplicateTo h1@(FileHandle path m1) h2@(FileHandle _ m2) = do
181181 -- if it happens just in the right moment.
182182 withHandle_' "hDuplicateTo" h1 m1 $ \h1_ -> do
183183 dupHandleTo path h1 Nothing h2_ h1_ (Just handleFinalizer)
184−hDuplicateTo h1@(DuplexHandle path r1 w1) h2@(DuplexHandle _ r2 w2) = do
184+hDuplicateTo' h1@(DuplexHandle path r1 w1) h2@(DuplexHandle _ r2 w2) = do
185185 withHandle__' "hDuplicateTo" h2 w2 $ \w2_ -> do
186186 _ <- hClose_help w2_
187187 withHandle_' "hDuplicateTo" h1 w1 $ \w1_ -> do
@@ -190,7 +190,7 @@ hDuplicateTo h1@(DuplexHandle path r1 w1) h2@(DuplexHandle _ r2 w2) = do
190190 _ <- hClose_help r2_
191191 withHandle_' "hDuplicateTo" h1 r1 $ \r1_ -> do
192192 dupHandleTo path h1 (Just w1) r2_ r1_ Nothing
193−hDuplicateTo h1 _ =
193+hDuplicateTo' h1 _ =
194194 ioe_dupHandlesNotCompatible h1
195195
196196-- | This is copied unmodified from GHC since it is not exposed.
src/Development/IDE/LSP/LanguageServer.hs+1−1
@@ -48,7 +48,7 @@ runLanguageServer options userHandlers getIdeState = do
4848 -- to stdout. This guards against stray prints from corrupting the JSON-RPC
4949 -- message stream.
5050 newStdout <- hDuplicate stdout
51− stderr `Ghcide.hDuplicateTo` stdout
51+ stderr `Ghcide.hDuplicateTo'` stdout
5252 hSetBuffering stderr NoBuffering
5353 hSetBuffering stdout NoBuffering
5454