From 0ad03de570771bb04f383a04886bc58071b50b7b Mon Sep 17 00:00:00 2001
From: David Binder <david.binder@uni-tuebingen.de>
Date: Thu, 10 Aug 2023 16:10:34 +0200
Subject: [PATCH] Switch the function "readMix" from lazy "readFile" to strict
 "readFileUtf8", similar to how "readTix" is implemented

---
 Trace/Hpc/Mix.hs | 4 ++--
 changelog.md     | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Trace/Hpc/Mix.hs b/Trace/Hpc/Mix.hs
index 8907f17..7a05ee5 100644
--- a/Trace/Hpc/Mix.hs
+++ b/Trace/Hpc/Mix.hs
@@ -28,7 +28,7 @@ import System.FilePath
 -- been introduced in that module, accessed by tick-number position
 -- in the list
 
-import Trace.Hpc.Util (HpcPos, insideHpcPos, Hash, HpcHash(..), catchIO)
+import Trace.Hpc.Util (HpcPos, insideHpcPos, Hash, HpcHash(..), catchIO, readFileUtf8)
 import Trace.Hpc.Tix
 
 -- | 'Mix' is the information about a modules static properties, like
@@ -93,7 +93,7 @@ readMix dirNames mod' = do
    res <- sequence [ (do let mixPath    = mixName dirName modName
                              parseError = error ("can not parse " ++ mixPath)
                              parse      = fromMaybe parseError . readMaybe
-                         mix <- parse `fmap` readFile mixPath
+                         mix <- parse `fmap` readFileUtf8 mixPath
                          case mod' of
                             Left  _   -> return $ Just mix -- Bypass hash check
                             Right tix -> return $ checkHash tix mix mixPath)
diff --git a/changelog.md b/changelog.md
index 1603bec..1b8647d 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,8 @@
 # Changelog for [`hpc` package](http://hackage.haskell.org/package/hpc)
 
-## 0.7.0.0 *July 2023* 
+## 0.7.0.0 *August 2023* 
 
+  * The function `readMix` no longer uses lazyIO to read `.mix` files, which is consistent with the behaviour of the `readTix` function.
   * The import of the modules from this package is no longer considered safe, since we use functions from the `System.Directory` module from the `directory` package which is no longer considered safe beginning from version `1.3.8`.
   * Replace uses of `String` by `FilePath` in functions `readTix`, `writeTix`, `getTixFileName`, `readMix` and `mixCreate`.
   * Remove support for version of GHC below 8.6
-- 
GitLab