hpc 0.6.2.0 → 0.7.0.2
raw patch · 6 files changed
Files
- Trace/Hpc/Mix.hs +13/−25
- Trace/Hpc/Reflect.hsc +0/−4
- Trace/Hpc/Tix.hs +9/−19
- Trace/Hpc/Util.hs +4/−13
- changelog.md +16/−0
- hpc.cabal +10/−12
Trace/Hpc/Mix.hs view
@@ -1,9 +1,3 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 709-{-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 701-{-# LANGUAGE Trustworthy #-}-#endif --------------------------------------------------------------- -- Colin Runciman and Andy Gill, June 2006 ---------------------------------------------------------------@@ -26,11 +20,7 @@ import Data.Maybe (catMaybes, fromMaybe) import Data.Time (UTCTime) import Data.Tree-#if MIN_VERSION_base(4,6,0) import Text.Read (readMaybe)-#else-import Data.Char (isSpace)-#endif import System.FilePath @@ -38,16 +28,9 @@ -- 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 -#if !MIN_VERSION_base(4,6,0)-readMaybe :: Read a => String -> Maybe a-readMaybe s = case reads s of- [(x, s')] | all isSpace s' -> Just x- _ -> Nothing-#endif- -- | 'Mix' is the information about a modules static properties, like -- location of Tix's in a file. --@@ -88,16 +71,21 @@ toHash QualBinBox = 0x30 --- | Create is mix file.-mixCreate :: String -- ^ Dir Name- -> String -- ^ module Name- -> Mix -- ^ Mix DataStructure+-- | Write a mix file to disk.+-- +-- The following command creates the mix file under the location "\/home\/user\/main\/Main.mix"+--+-- > mixCreate "/home/user/main" "Main" mix++mixCreate :: FilePath -- ^ Name of the target directory.+ -> String -- ^ Name of the module for which the mix file is created.+ -> Mix -- ^ The Mix data structure. -> IO () mixCreate dirName modName mix = writeFile (mixName dirName modName) (show mix) -- | Read a mix file.-readMix :: [String] -- ^ Dir Names+readMix :: [FilePath] -- ^ Dir Names -> Either String TixModule -- ^ module wanted -> IO Mix readMix dirNames mod' = do@@ -105,7 +93,7 @@ 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)@@ -113,7 +101,7 @@ | dirName <- dirNames ] case catMaybes res of- xs@(x:_:_) | any (/= x) (tail xs) ->+ xs@(x : tl@(_ : _)) | any (/= x) tl -> -- Only complain if multiple *different* `Mix` files with the -- same name are found (#9619). error $ "found " ++ show(length xs) ++ " different instances of "
Trace/Hpc/Reflect.hsc view
@@ -1,8 +1,4 @@ {-# LANGUAGE ForeignFunctionInterface #-}-#ifdef __GLASGOW_HASKELL__-{-# LANGUAGE Trustworthy #-}-#endif- module Trace.Hpc.Reflect ( clearTix , examineTix
Trace/Hpc/Tix.hs view
@@ -1,11 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704-{-# LANGUAGE Safe, DeriveGeneric, StandaloneDeriving #-}-#elif __GLASGOW_HASKELL__ >= 702--- System.FilePath in filepath version 1.2.0.1 isn't marked or implied Safe,--- as shipped with GHC 7.2.-{-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE DeriveGeneric, StandaloneDeriving #-} ------------------------------------------------------------ -- Andy Gill and Colin Runciman, June 2006 ------------------------------------------------------------@@ -16,11 +9,8 @@ tixModuleName, tixModuleHash, tixModuleTixs, readTix, writeTix, getTixFileName) where -#if __GLASGOW_HASKELL__ >= 704-import GHC.Generics (Generic) import Control.DeepSeq (NFData)-#endif-+import GHC.Generics (Generic) import System.FilePath (replaceExtension) import Trace.Hpc.Util (Hash, catchIO, readFileUtf8, writeFileUtf8)@@ -30,12 +20,10 @@ data Tix = Tix [TixModule] deriving (Read, Show, Eq) -#if __GLASGOW_HASKELL__ >= 704 -- | @since 0.6.2.0 deriving instance (Generic Tix) -- | @since 0.6.2.0 instance NFData Tix-#endif data TixModule = TixModule String -- module name@@ -44,12 +32,10 @@ [Integer] -- actual ticks deriving (Read, Show, Eq) -#if __GLASGOW_HASKELL__ >= 704 -- | @since 0.6.2.0 deriving instance (Generic TixModule) -- | @since 0.6.2.0 instance NFData TixModule-#endif -- TODO: Turn extractors below into proper 'TixModule' field-labels tixModuleName :: TixModule -> String@@ -62,19 +48,23 @@ -- We /always/ read and write Tix from the current working directory. -- | Read a @.tix@ File.-readTix :: String+readTix :: FilePath -> IO (Maybe Tix) readTix tixFilename = catchIO (fmap (Just . read) $ readFileUtf8 tixFilename) (const $ return Nothing) -- | Write a @.tix@ File.-writeTix :: String+writeTix :: FilePath -> Tix -> IO () writeTix name tix = writeFileUtf8 name (show tix) -- | 'getTixFullName' takes a binary or @.tix@-file name, -- and normalizes it into a @.tix@-file name.-getTixFileName :: String -> String+--+-- > getTixFileName "example.hs" == "example.tix"+-- > getTixFileName "example.tar.gz" == "example.tar.tix"+-- > getTixFileName "example.tix" == "example.tix"+getTixFileName :: FilePath -> FilePath getTixFileName str = replaceExtension str "tix"
Trace/Hpc/Util.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704-{-# LANGUAGE Safe, DeriveGeneric, StandaloneDeriving #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE DeriveGeneric, StandaloneDeriving #-} ----------------------------------------- -- Andy Gill and Colin Runciman, June 2006 ------------------------------------------@@ -22,16 +17,14 @@ , writeFileUtf8 ) where -#if __GLASGOW_HASKELL__ >= 704-import GHC.Generics (Generic)-#endif-+import Prelude hiding (Foldable(..)) import Control.DeepSeq (deepseq, NFData) import qualified Control.Exception as Exception-import Data.List(foldl') import Data.Char (ord) import Data.Bits (xor)+import Data.Foldable (Foldable(..)) import Data.Word+import GHC.Generics (Generic) import System.Directory (createDirectoryIfMissing) import System.FilePath (takeDirectory) import System.IO@@ -85,12 +78,10 @@ newtype Hash = Hash Word32 deriving (Eq) -#if __GLASGOW_HASKELL__ >= 704 -- | @since 0.6.2.0 deriving instance (Generic Hash) -- | @since 0.6.2.0 instance NFData Hash-#endif instance Read Hash where readsPrec p n = [ (Hash v,rest)
changelog.md view
@@ -1,4 +1,20 @@ # Changelog for [`hpc` package](http://hackage.haskell.org/package/hpc)++## 0.7.0.2 *May 2024*++ * Bump upper bounds of dependencies on base and time libraries.++## 0.7.0.1 *January 2024*++ * Bump upper bounds of dependencies on filepath and containers libraries.++## 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+ ## 0.6.2.0 *September 2021* * Addition of `NFData` instances for `Tix` and `TixModule`
hpc.cabal view
@@ -1,7 +1,8 @@+cabal-version: 2.2 name: hpc-version: 0.6.2.0+version: 0.7.0.2 -- NOTE: Don't forget to update ./changelog.md-license: BSD3+license: BSD-3-Clause license-file: LICENSE author: Andy Gill maintainer: ghc-devs@haskell.org@@ -9,15 +10,13 @@ category: Control synopsis: Code Coverage Library for Haskell build-type: Simple-cabal-version:>=1.10-tested-with: GHC==8.0.*, GHC==7.10.*, GHC==7.8.*, GHC==7.6.*, GHC==7.4.*, GHC==7.2.2 description: This package provides the code coverage library for Haskell. .- See <http://www.haskell.org/haskellwiki/Haskell_program_coverage> for more+ See <https://www.haskell.org/haskellwiki/Haskell_program_coverage> for more information. -extra-source-files:+extra-doc-files: changelog.md source-repository head@@ -26,7 +25,6 @@ Library default-language: Haskell98- other-extensions: CPP exposed-modules: Trace.Hpc.Util@@ -35,10 +33,10 @@ Trace.Hpc.Reflect Build-Depends:- base >= 4.4.1 && < 4.18,- containers >= 0.4.1 && < 0.7,- deepseq >= 1.1 && < 1.5,+ base >= 4.12 && < 4.21,+ containers >= 0.4.1 && < 0.8,+ deepseq >= 1.1 && < 1.6, directory >= 1.1 && < 1.4,- filepath >= 1 && < 1.5,- time >= 1.2 && < 1.13+ filepath >= 1 && < 1.6,+ time >= 1.2 && < 1.15 ghc-options: -Wall