Skip to content

Commit

Permalink
Merge pull request #49 from TeofilC/wip/wherefrom-compat
Browse files Browse the repository at this point in the history
Use wherefrom-compat
  • Loading branch information
coot authored Feb 6, 2024
2 parents 4ef360e + 99872f3 commit ea6f0e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ used and how it works internally.


`nothunks` will try to get source information from info tables. For that one
needs to use `GHC` newer than `9.4` and compile the code with
needs to use `GHC` `9.2` or newer and compile the code with
`-finfo-table-map`. More precise information will be available if
`-fdistinct-constructor-tables` flag is used as well. We don't support this
feature in `GHC-9.2` (although an earlier version of `whereFrom`
is available in `base`).
`-fdistinct-constructor-tables` flag is used as well.
2 changes: 2 additions & 0 deletions nothunks.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ library
-- Whatever is bundled with ghc
, ghc-heap

if impl(ghc >= 9.2)
build-depends: wherefrom-compat >= 0.1.1.0 && < 0.2.0.0
if flag(bytestring)
build-depends: bytestring >= 0.10 && < 0.13
if flag(text)
Expand Down
6 changes: 3 additions & 3 deletions src/NoThunks/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ import GHC.Stack
import Numeric.Natural
#endif

#if MIN_VERSION_base(4,18,0)
import GHC.InfoProv
#if MIN_VERSION_base(4,16,0)
import GHC.InfoProv.Compat
#endif

import qualified Control.Concurrent.MVar as MVar
Expand Down Expand Up @@ -231,7 +231,7 @@ newtype ThunkInfo = ThunkInfo { thunkInfo :: Either Context Info }
deriving Show

getThunkInfo :: Context -> a -> IO ThunkInfo
#if MIN_VERSION_base(4,18,0)
#if MIN_VERSION_base(4,16,0)
getThunkInfo ctxt a = ThunkInfo . maybe (Left ctxt) (Right . fmt) <$> whereFrom a
where
fmt :: InfoProv -> Info
Expand Down

0 comments on commit ea6f0e8

Please sign in to comment.