-
Notifications
You must be signed in to change notification settings - Fork 41
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
GHC 9.2 support #139
GHC 9.2 support #139
Changes from all commits
817f217
8129b75
e206ddb
dd4c8c3
63307e0
fae5e6d
01780b6
0eafd53
a73aceb
84c7483
38c82b9
3788854
b35fff5
12152a3
c6202d4
328a7e1
21eafe1
541ab9b
bdabfc2
068c196
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,11 @@ module Hint.Base ( | |
|
||
GhcError(..), InterpreterError(..), mayFail, catchIE, | ||
|
||
InterpreterSession, SessionData(..), GhcErrLogger, | ||
InterpreterSession, SessionData(..), | ||
InterpreterState(..), fromState, onState, | ||
InterpreterConfiguration(..), | ||
ImportList(..), ModuleQualification(..), ModuleImport(..), | ||
|
||
runGhc1, runGhc2, | ||
|
||
ModuleName, PhantomModule(..), | ||
findModule, moduleIsLoaded, | ||
withDynFlags, | ||
|
@@ -99,19 +97,11 @@ type RunGhc m a = | |
(forall n.(MonadIO n, MonadMask n) => GHC.GhcT n a) | ||
-> m a | ||
|
||
type RunGhc1 m a b = | ||
(forall n.(MonadIO n, MonadMask n) => a -> GHC.GhcT n b) | ||
-> (a -> m b) | ||
|
||
type RunGhc2 m a b c = | ||
(forall n.(MonadIO n, MonadMask n) => a -> b -> GHC.GhcT n c) | ||
-> (a -> b -> m c) | ||
|
||
data SessionData a = SessionData { | ||
internalState :: IORef InterpreterState, | ||
versionSpecific :: a, | ||
ghcErrListRef :: IORef [GhcError], | ||
ghcErrLogger :: GhcErrLogger | ||
ghcLogger :: GHC.Logger | ||
} | ||
|
||
-- When intercepting errors reported by GHC, we only get a ErrUtils.Message | ||
|
@@ -135,17 +125,9 @@ mapGhcExceptions buildEx action = | |
catchIE :: MonadInterpreter m => m a -> (InterpreterError -> m a) -> m a | ||
catchIE = MC.catch | ||
|
||
type GhcErrLogger = GHC.LogAction | ||
|
||
-- | Module names are _not_ filepaths. | ||
type ModuleName = String | ||
|
||
runGhc1 :: MonadInterpreter m => RunGhc1 m a b | ||
runGhc1 f a = runGhc (f a) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I must admit I have no idea why this unusual idiom was in there to begin with. Thanks for getting rid of it! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup! For the record, I removed it in this PR because I added a parameter to |
||
|
||
runGhc2 :: MonadInterpreter m => RunGhc2 m a b c | ||
runGhc2 f a = runGhc1 (f a) | ||
|
||
-- ================ Handling the interpreter state ================= | ||
|
||
fromState :: MonadInterpreter m => (InterpreterState -> a) -> m a | ||
|
@@ -179,7 +161,8 @@ showGHC :: (MonadInterpreter m, GHC.Outputable a) => a -> m String | |
showGHC a | ||
= do unqual <- runGhc GHC.getPrintUnqual | ||
withDynFlags $ \df -> | ||
return $ GHC.showSDocForUser df unqual (GHC.ppr a) | ||
-- TODO: get unit state from somewhere? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. everything we evaluate within a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense; however, the tests do pass. So maybe merge this now to just get GHC 9.2 support, and add a ticket to add unit state? Unless you have a quick way to resolve this now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done, thanks for the suggestion! since this is only a |
||
return $ GHC.showSDocForUser df GHC.emptyUnitState unqual (GHC.ppr a) | ||
|
||
-- ================ Misc =================================== | ||
|
||
|
@@ -189,7 +172,7 @@ data PhantomModule = PhantomModule{pmName :: ModuleName, pmFile :: FilePath} | |
|
||
findModule :: MonadInterpreter m => ModuleName -> m GHC.Module | ||
findModule mn = mapGhcExceptions NotAllowed $ | ||
runGhc2 GHC.findModule mod_name Nothing | ||
runGhc $ GHC.findModule mod_name Nothing | ||
where mod_name = GHC.mkModuleName mn | ||
|
||
moduleIsLoaded :: MonadInterpreter m => ModuleName -> m Bool | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if those ifdefs become too confusing, I'm willing to drop support for older versions of ghc, say, older than 8.10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debian stable, testing and unstable is on ghc 8.4.4. https://packages.debian.org/search?keywords=ghc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err, I actually dropped support for ghc 8.4 two releases ago! I am guessing that Debian is not just using an older compiler, but also older libraries? Or is the fact that hint does not support ghc-8.4 currently causing problems in the Debian community? I'm happy to increase the range of supported versions if requested, I just default to a narrower support window in order to avoid wasting effort in the likely case that nobody cares.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As no-one has complained, I guess it's not an issue. I think a fair number of Tidal users are on 8.4, but hint isn't a dependency for them.