-
-
Save wavewave/d35f8ce60f7034ba2792c79f288153ae to your computer and use it in GitHub Desktop.
getDoc retrigger unnecessary recompilation with obscure message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ghci A B | |
GHCi, version 9.6.1: https://www.haskell.org/ghc/ :? for help | |
[1 of 2] Compiling A ( A.hs, interpreted ) | |
[2 of 2] Compiling B ( B.hs, interpreted ) | |
Ok, two modules loaded. | |
-- change B.hs (add a space) | |
ghci> :r | |
[2 of 2] Compiling B ( src/B.hs, interpreted ) [Source file changed] | |
src/B.hs:9:11: error: [GHC-87897] | |
• Exception when trying to run compile-time code: | |
<interactive>:1:1: error: | |
attempting to use module `main:A' (src/A.hs) which is not loaded | |
Code: (getDoc (DeclDoc ''Double) | |
>>= | |
\ doc | |
-> [| doc |] | |
pending(rn) [<doc, Language.Haskell.TH.Syntax.lift doc>]) | |
• In the untyped splice: | |
$(getDoc (DeclDoc ''Double) >>= \ doc -> [| doc |]) | |
| | |
9 | let s = $(getDoc (DeclDoc ''Double) >>= \doc -> [|doc|]) | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
Failed, one module loaded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A where | |
irrelevant :: IO () | |
irrelevant = putStrLn "irrelevant" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
module B (test) where | |
import Language.Haskell.TH | |
test :: IO () | |
test = do | |
let s = $(getDoc (DeclDoc ''Double) >>= \doc -> [|doc|]) | |
print s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment