packages feed

wherefrom-compat 0.1.1.0 → 0.1.1.1

raw patch · 3 files changed

+45/−3 lines, 3 filesdep ~base

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -1,5 +1,8 @@ # Revision history for wherefrom-compat +## 0.1.1.1 -- 2024/05/24+* Support GHC-9.10+ ## 0.1.1.0 -- 2024/02/01  * Fix interface around srcFile/srcSpan.
src/GHC/InfoProv/Compat.hs view
@@ -6,7 +6,45 @@   , whereFrom   ) where -#if MIN_VERSION_base(4,18,0)+#if MIN_VERSION_base(4,20,0)+import qualified GHC.InfoProv as IP++data InfoProv = InfoProv {+  ipName :: String,+  ipDesc :: String,+  ipTyDesc :: String,+  ipLabel :: String,+  ipMod :: String,+  ipSrcFile :: String,+  ipSrcSpan :: String+} deriving (Eq, Show)+++-- | Get information about where a value originated from.+--+-- This information is stored statically in a binary when @super-duper@ is enabled.+-- The source positions will be greatly improved by also enabled debug information with @-g3@.+-- Finally you can enable @-fdistinct-constructor-tables@ to get more precise information about data constructor allocations.+--+-- The information is collect by looking at the info table address of a specific closure and then consulting a specially generated map (by @-finfo-table-map@)+-- to find out where we think the best source position to describe that info table arose from.+whereFrom :: a -> IO (Maybe InfoProv)+whereFrom v = do+  xs <- IP.whereFrom v+  pure $ do+    ip <- xs+    Just $+      InfoProv+       { ipName = IP.ipName ip+       , ipDesc = show . fromEnum $ IP.ipDesc ip+       , ipTyDesc = IP.ipTyDesc ip+       , ipLabel = IP.ipLabel ip+       , ipMod = IP.ipMod ip+       , ipSrcFile = IP.ipSrcFile ip+       , ipSrcSpan = IP.ipSrcSpan ip+       }++#elif MIN_VERSION_base(4,18,0) import GHC.InfoProv (InfoProv(..), whereFrom) #elif MIN_VERSION_base(4,17,0) import qualified GHC.Stack.CCS as CCS
wherefrom-compat.cabal view
@@ -1,6 +1,6 @@ cabal-version:   3.0 name:            wherefrom-compat-version:         0.1.1.0+version:         0.1.1.1 synopsis:        A compatibility layer for GHC's 'wherefrom' function description:   A compatibility layer for GHC's 'wherefrom' function,@@ -22,6 +22,7 @@   ||  ==9.4.7    ||  ==9.6.3    ||  ==9.8.1+  ||  ==9.10.1  common warnings   ghc-options: -Wall@@ -29,7 +30,7 @@ library   import:           warnings   exposed-modules:  GHC.InfoProv.Compat-  build-depends:    base >=4.16.0.0 && <4.20.0.0+  build-depends:    base >=4.16.0.0 && <4.21.0.0   hs-source-dirs:   src   default-language: Haskell2010