git.iko.soy/typeable/haskell-stack-trace-plugin
on master help sign in
haskell-stack-trace-plugin.cabal+2−2
since splitsnapshots
unifiedsplit
@@ -32,13 +32,13 @@ flag dev
32 default: False
32 default: False
33
33
34common common-opts
34common common-opts
35− build-depends: base >=4.12 && <4.16
35+ build-depends: base >=4.12 && <4.18
36 default-language: Haskell2010
36 default-language: Haskell2010
37
37
38library
38library
39 import: common-opts
39 import: common-opts
40 hs-source-dirs: src
40 hs-source-dirs: src
41− build-depends: ghc ^>=8.6 || ^>=8.8 || ^>=8.10 || ^>=9.0
41+ build-depends: ghc ^>=8.6 || ^>=8.8 || ^>=8.10 || ^>=9.0 || ^>=9.2 || ^>=9.4
42 exposed-modules: StackTrace.Plugin
42 exposed-modules: StackTrace.Plugin
43
43
44 if flag(dev)
44 if flag(dev)
src/StackTrace/Plugin.hs+9−3
@@ -5,6 +5,7 @@ module StackTrace.Plugin (plugin) where
5
5
6import Control.Arrow (first)
6import Control.Arrow (first)
7import Data.Monoid (Any(Any, getAny))
7import Data.Monoid (Any(Any, getAny))
8+import GHC.Types.SrcLoc
8#if __GLASGOW_HASKELL__ >= 900
9#if __GLASGOW_HASKELL__ >= 900
9import GHC.Plugins
10import GHC.Plugins
10#else
11#else
@@ -49,9 +50,14 @@ importDeclQualified = QualifiedPre
49
50
50ghcStackImport :: Located (ImportDecl (GhcPass p))
51ghcStackImport :: Located (ImportDecl (GhcPass p))
51ghcStackImport =
52ghcStackImport =
52− noLoc $
53+ L srcSpan $
53 (simpleImportDecl $ mkModuleName "GHC.Stack")
54 (simpleImportDecl $ mkModuleName "GHC.Stack")
54− {ideclQualified = importDeclQualified, ideclAs = Just $ noLoc ghcStackModuleName}
55+ { ideclQualified = importDeclQualified, ideclAs = Just $ noLoc ghcStackModuleName }
56+ where
57+ -- This is for GHC-9 related problems. @noLoc@ causes GHC to throw warnings
58+ -- about unused imports. Even if the import is used
59+ -- See: https://github.com/waddlaw/haskell-stack-trace-plugin/issues/16
60+ srcSpan = RealSrcSpan (realSrcLocSpan $ mkRealSrcLoc "haskell-stack-trace-plugin:very-unique-file-name-to-avoid-collision" 1 1) Nothing
55
61
56#if __GLASGOW_HASKELL__ >= 900
62#if __GLASGOW_HASKELL__ >= 900
57updateHsModule :: HsModule -> HsModule
63updateHsModule :: HsModule -> HsModule
@@ -59,7 +65,7 @@ updateHsModule :: HsModule -> HsModule
59updateHsModule :: HsModule GhcPs -> HsModule GhcPs
65updateHsModule :: HsModule GhcPs -> HsModule GhcPs
60#endif
66#endif
61updateHsModule hsm =
67updateHsModule hsm =
62− hsm {hsmodDecls = hsmodDecls'}
68+ hsm {hsmodImports = hsmodImports', hsmodDecls = hsmodDecls'}
63 where
69 where
64 -- Traverse the haskell AST; if we have to add some HasStack
70 -- Traverse the haskell AST; if we have to add some HasStack
65 -- constraint we set a flag in a (Any,) functor.
71 -- constraint we set a flag in a (Any,) functor.