Skip to content

Commit 8d3e2f6

Browse files
committed
Inline utility function
1 parent a717bc8 commit 8d3e2f6

File tree

1 file changed

+5
-7
lines changed
  • plugins/hls-hlint-plugin/src/Ide/Plugin

1 file changed

+5
-7
lines changed

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ applyHint ide nfp mhint =
369369
-- the "Redundant bracket" hint will never be executed
370370
-- because SrcSpan (1,20,??,??) doesn't contain position (1,13).
371371
#ifdef GHC_LIB
372+
let writeFileUTF8NoNewLineTranslation file txt =
373+
withFile file WriteMode $ \h -> do
374+
hSetEncoding h utf8
375+
hSetNewlineMode h noNewlineTranslation
376+
hPutStr h (T.unpack txt)
372377
res <-
373378
liftIO $ withSystemTempFile (takeFileName fp) $ \temp h -> do
374379
hClose h
@@ -423,10 +428,3 @@ bimapExceptT f g (ExceptT m) = ExceptT (fmap h m) where
423428
h (Left e) = Left (f e)
424429
h (Right a) = Right (g a)
425430
{-# INLINE bimapExceptT #-}
426-
427-
writeFileUTF8NoNewLineTranslation :: FilePath -> T.Text -> IO()
428-
writeFileUTF8NoNewLineTranslation file txt =
429-
withFile file WriteMode $ \h -> do
430-
hSetEncoding h utf8
431-
hSetNewlineMode h noNewlineTranslation
432-
hPutStr h (T.unpack txt)

0 commit comments

Comments
 (0)