Skip to content

Commit 27a7ccb

Browse files
committed
Revise fileContentAsString encoding (issue steindani#2)
1 parent 913ca87 commit 27a7ccb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

IncludeFilter.hs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ stripPandoc p =
7373
Right (Pandoc _ blocks) -> blocks
7474

7575
fileContentAsString :: String -> IO String
76-
fileContentAsString file = do
77-
let handle = openFile file ReadMode
78-
fmap (`hSetEncoding` utf8) handle
79-
!contents <- fmap hGetContents handle
80-
fmap hClose handle
81-
contents
76+
fileContentAsString file = withFile file ReadMode $ \handle -> do
77+
hSetEncoding handle utf8
78+
hGetContents handle
8279

8380
fileContentAsBlocks :: String -> IO [Block]
8481
fileContentAsBlocks file = do

0 commit comments

Comments
 (0)