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

Workaround for a GHC bug with -XTemplateHaskell and ghci (fixes #303) #312

Merged
merged 2 commits into from
Nov 12, 2021

Conversation

sol
Copy link
Owner

@sol sol commented Nov 12, 2021

@sol sol requested a review from andreasabel November 12, 2021 04:40
@sol sol merged commit 6220b36 into main Nov 12, 2021
@sol sol deleted the fix-th-bug branch November 12, 2021 04:51
Copy link
Collaborator

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already merged, but I anyway have 2 questions (see below).

doctest.cabal Show resolved Hide resolved
@@ -55,13 +56,17 @@ withInterpreter flags action = do
let
args = flags ++ [
"--interactive"
, xTemplateHaskell
#if __GLASGOW_HASKELL__ >= 802
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the meaning of such an #if? The #if is evaluated when doctest is compiled, and we use such #ifs all over the place to ensure compilation with different GHCs. But this #if does not make to seem a difference on the compilation of doctest, but when I run doctest.
Could it be a problem when I run doctest with a different GHC version than it was compiled with?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doctest uses both ghc (the library) and ghc --interactive (the executable). The former is used to extract Haddock comments, the later is used to check examples. If we would only depend on the executable, we could just use whatever ghc is on the PATH. But with ghc the library we can only depend on one version (specifically, the version we compile doctest with). For that reason we fix both, ghc the library and ghc the executable to the ghc version we compile against at compile time. The library version is fixed simply by depending on it. To fix the executable version we use ghc-paths.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this makes sense if doctest sits within a per-GHC buildtree.
(For some reason, I have doctest in my PATH, but that does not make sense in such a scenario.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants