You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.
In a project using haskell-src-exts as a transitive dependency ghc mod hangs 100% cpu usage when loading a file with quasi quotes or template haskell. On my machine this takes about
I have not tested with other large packages as dependencies.
To reproduce:
Main.hs
{-# language QuasiQuotes #-}
module Main where
main :: IO ()
main = pure 1
Observe that ghc-mod hangs after printing Target needs interpeter, switching to LinkInMemory/HscInterpreted. Perfectly normal if anything is using TemplateHaskell, QuasiQuotes or PatternSynonyms.
Remove the haskell-src-exts line from ghc-mod-test.cabal
Run ghc-mod browse Main.hs --verbose 7
Observe that ghc-mod no longer hangs and correctly identifies the type error in Main.hs
$ ghc-mod --version
ghc-mod version 5.9.0.0 compiled by GHC 8.6.4
d96119645c12905858468a98429f6a887330e7d9
ghc-mod's log:
info: Found Cabal project at: /home/j/projects/ghc-mod-test
info: Using Cabal project at: /home/j/projects/ghc-mod-test
DEBUG: setup configuration is out of date
DEBUG: reconfiguring Cabal project
Warning: The configure command is a part of the legacy v1 style of cabal
usage.
Please switch to using either the new project style and the new-configure
command or the legacy v1-configure alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.
For more information, see: https://wiki.haskell.org/Cabal/NewBuild
Warning: ghc-mod-test.cabal:0:0: A package using section syntax must specify
at least
'cabal-version: >= 1.2'.
Warning: ghc-mod-test.cabal:0:0: A package using section syntax must specify
at least
'cabal-version: >= 1.2'.
DEBUG: reading cache: /home/j/projects/ghc-mod-test/dist/setup-config.ghc-mod.package-options
DEBUG: regenerating cache: /home/j/projects/ghc-mod-test/dist/setup-config.ghc-mod.package-options (input data changed)
DEBUG: writing memory cache: /home/j/projects/ghc-mod-test/dist/setup-config.ghc-mod.package-options
DEBUG: reading cache: /home/j/projects/ghc-mod-test/dist/setup-config.ghc-mod.cabal-components
DEBUG: regenerating cache: /home/j/projects/ghc-mod-test/dist/setup-config.ghc-mod.cabal-components (input data changed)
DEBUG: writing memory cache: /home/j/projects/ghc-mod-test/dist/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
["-i","-idist/build/ghc-mod-test/ghc-mod-test-tmp","-i.","-idist/build/ghc-mod-test/autogen","-idist/build/global-autogen","-Idist/build/ghc-mod-test/autogen","-Idist/build/global-autogen","-Idist/build/ghc-mod-test/ghc-mod-test-tmp","-optP-include","-optPdist/build/ghc-mod-test/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint: []
DEBUG: making sure autogen files exist
DEBUG: autogen files out of sync
DEBUG: writing Cabal autogen files
DEBUG: reading cache: dist/setup-config.ghc-mod.resolved-components
DEBUG: resolvedComponentsCache: files changed: none
DEBUG: resolveGmComponent:
["-optP-include","-optPdist/build/autogen/cabal_macros.h"]
DEBUG: resolveGmComponent:
["-i","-idist/build/ghc-mod-test/ghc-mod-test-tmp","-i.","-idist/build/ghc-mod-test/autogen","-idist/build/global-autogen","-Idist/build/ghc-mod-test/autogen","-Idist/build/global-autogen","-Idist/build/ghc-mod-test/ghc-mod-test-tmp","-optP-include","-optPdist/build/ghc-mod-test/autogen/cabal_macros.h","-XHaskell98","-optP-include","-optPdist/build/autogen/cabal_macros.h"]
DEBUG: regenerating cache: dist/setup-config.ghc-mod.resolved-components (input data changed)
DEBUG: writing memory cache: dist/setup-config.ghc-mod.resolved-components
DEBUG: Could not find a component assignment, falling back to
picking library component in cabal file.
VOMIT: hide all packages(ignore .ghc.environment):: DontLoadGhcEnvironment
VOMIT: Using the following mapped files:
VOMIT: Using the following mapped files:
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" "dist/build/ghc-mod-test/ghc-mod-test-tmp" "-odir" "dist/build/ghc-mod-test/ghc-mod-test-tmp" "-hidir" "dist/build/ghc-mod-test/ghc-mod-test-tmp" "-stubdir" "dist/build/ghc-mod-test/ghc-mod-test-tmp" "-i" "-idist/build/ghc-mod-test/ghc-mod-test-tmp" "-i." "-idist/build/ghc-mod-test/autogen" "-idist/build/global-autogen" "-Idist/build/ghc-mod-test/autogen" "-Idist/build/global-autogen" "-Idist/build/ghc-mod-test/ghc-mod-test-tmp" "-optP-include" "-optPdist/build/ghc-mod-test/autogen/cabal_macros.h" "-hide-all-packages" "-Wmissing-home-modules" "-package-id" "base-4.12.0.0" "-package-id" "haskell-src-exts-1.20.3-2fryh11Yuz7lCtLeeIQn8" "-XHaskell98" "-Wno-missing-home-modules" "-O0" "-fno-warn-missing-home-modules"
DEBUG: initSession: Session not initialized, creating new one
VOMIT: Using the following targets: "Main.hs"
DEBUG: loadTargets: Loading: Main.hs
DEBUG: loadTargets: filterModSums: False
info: loadTargets:
Target needs interpeter, switching to LinkInMemory/HscInterpreted. Perfectly normal if anything is using TemplateHaskell, QuasiQuotes or PatternSynonyms.
<<<LONG WAIT>>>
Main.hs:6:13: error:
• No instance for (Num ()) arising from the literal ‘1’
• In the first argument of ‘pure’, namely ‘1’
In the expression: pure 1
In an equation for ‘main’: main = pure 1
DEBUG: loadTargets: Loading done
EXCEPTION: browse:
Could not find module ‘Main.hs’
Use -v to see a list of the files searched for.
/nix/store/wqrayxv60mxhyw5zmx0hhgj62qz3id58-ghc-mod-5.9.0.0/bin/ghc-mod brows 189.70s user 0.35s system 100% cpu 3:10.00 total
The text was updated successfully, but these errors were encountered:
expipiplus1
changed the title
ghc-mod hangs when using template haskell in a project depending on haskell-src-exts
ghc-mod takes a very long time to check a module using template haskell in a project depending on haskell-src-exts
Apr 19, 2019
Summary
In a project using
haskell-src-exts
as a transitive dependency ghc mod hangs 100% cpu usage when loading a file with quasi quotes or template haskell. On my machine this takes aboutI have not tested with other large packages as dependencies.
To reproduce:
Main.hs
ghc-mod-test.cabal
Run
ghc-mod browse Main.hs --verbose 7
Observe that ghc-mod hangs after printing
Target needs interpeter, switching to LinkInMemory/HscInterpreted. Perfectly normal if anything is using TemplateHaskell, QuasiQuotes or PatternSynonyms.
Remove the
haskell-src-exts
line fromghc-mod-test.cabal
Run
ghc-mod browse Main.hs --verbose 7
Observe that ghc-mod no longer hangs and correctly identifies the type error in
Main.hs
Versions
d96119645c12905858468a98429f6a887330e7d9
ghc-mod's log:
The text was updated successfully, but these errors were encountered: