Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use wherefrom-compat #49

Merged
merged 1 commit into from
Feb 6, 2024
Merged
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
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
Loading