Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Language/Haskell/Exts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ readUTF8File :: FilePath -> IO String
readUTF8File fp = do
h <- openFile fp ReadMode
hSetEncoding h utf8
hGetContents h
c <- hGetContents h >>= \s -> length s `seq` return s
hClose h
return c

-- | Converts a parse result with comments to a parse result with comments and
-- unknown pragmas.
Expand Down
4 changes: 3 additions & 1 deletion tests/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ commentsTests dir = testGroup "Comments tests" $ do
readUTF8File :: FilePath -> IO String
readUTF8File fp = openFile fp ReadMode >>= \h -> do
hSetEncoding h utf8
hGetContents h
c <- hGetContents h >>= \s -> length s `seq` return s
hClose h
return c

parseUTF8FileWithComments :: ParseMode -> FilePath -> IO (ParseResult (Module SrcSpanInfo, [Comment]))
parseUTF8FileWithComments p fp = readUTF8File fp >>= (return . parseFileContentsWithComments p)
Expand Down