Repository navigation
Closed
Milestone
Description
$ brew switch ghc 7.8.0.20140228
$ cabal repl
Preprocessing library cabal-exit-early-0.0.0...
[1 of 1] Compiling A ( A.hs, dist/build/A.o )
A.hs:1:11: Not in scope: ‘a’
$ brew switch ghc 7.6.3
$ cabal repl
Preprocessing library cabal-exit-early-0.0.0...
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling A ( A.hs, interpreted )
A.hs:1:11: Not in scope: `a'
Failed, modules loaded: none.
>>= ^D
Leaving GHCi.
$
Test package is trivial:
name: cabal-exit-early
version: 0.0.0
cabal-version: >= 1.8
build-type: Simple
library
exposed-modules: A
build-depends: base
module A (a) whereWith GHC 7.8, cabal repl -v3:
Using internal setup method with build-type Simple and args:
["repl","--verbose=3","--builddir=dist"]
Component build order: library
creating dist/build
creating dist/build/autogen
Preprocessing library cabal-exit-early-0.0.0...
("/usr/local/bin/ghc",["--info"])
("/usr/local/bin/ghc",["--info"])
creating dist/build
Environment: (removed)
("/usr/local/bin/ghc",["--make","-v","-fbuilding-cabal-package","-O2","-static","-dynamic-too","-dynosuf","dyn_o","-dynhisuf","dyn_hi","-outputdir","dist/build","-odir","dist/build","-hidir","dist/build","-stubdir","dist/build","-i","-idist/build","-i.","-idist/build/autogen","-Idist/build/autogen","-Idist/build","-optP-include","-optPdist/build/autogen/cabal_macros.h","-package-name","cabal-exit-early-0.0.0","-hide-all-packages","-package-db","dist/package.conf.inplace","-package-id","base-4.7.0.0-fb03bfe8a1f8909585e120bf370d72fb","-XHaskell98","A"])
Glasgow Haskell Compiler, Version 7.8.0.20140228, stage 2 booted by GHC version 7.8.0.20140228
Using binary package database: /usr/local/Cellar/ghc/7.8.0.20140228/lib/ghc-7.8.0.20140228/package.conf.d/package.cache
Using binary package database: /Users/jztaylor/.ghc/x86_64-darwin-7.8.0.20140228/package.conf.d/package.cache
Using package config file: dist/package.conf.inplace
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-956814919b5482edf26ea1fe51da95b9
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-66adabd59b0be9f6df8506b708bbb9ab
wired-in package base mapped to base-4.7.0.0-fb03bfe8a1f8909585e120bf370d72fb
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.9.0.0-5cf2c715c8b93ff285548f30bcc3b8b0
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags:
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-956814919b5482edf26ea1fe51da95b9
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-66adabd59b0be9f6df8506b708bbb9ab
wired-in package base mapped to base-4.7.0.0-fb03bfe8a1f8909585e120bf370d72fb
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.9.0.0-5cf2c715c8b93ff285548f30bcc3b8b0
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Chasing dependencies:
Chasing modules from: *A.hs
Stable obj: []
Stable BCO: []
Ready for upsweep
[NONREC
ModSummary {
ms_hs_date = 2014-03-05 17:58:41 UTC
ms_mod = cabal-exit-early-0.0.0:A,
ms_textual_imps = [import (implicit) Prelude]
ms_srcimps = []
}]
*** Deleting temp files:
Deleting:
compile: input file A.hs
Created temporary directory: /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80443_0
*** Checking old interface for cabal-exit-early-0.0.0:A:
[1 of 1] Compiling A ( A.hs, dist/build/A.o )
*** Parser:
*** Renamer/typechecker:
A.hs:1:11: Not in scope: ‘a’
Upsweep partially successful.
*** Deleting temp files:
Deleting: /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80443_0/ghc80443_1.s
Warning: deleting non-existent /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80443_0/ghc80443_1.s
link(batch): upsweep (partially) failed OR
Main.main not exported; not linking.
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting: /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80443_0
/usr/local/bin/ghc returned ExitFailure 1
With GHC 7.6.3:
Using internal setup method with build-type Simple and args:
["repl","--verbose=3","--builddir=dist"]
Component build order: library
creating dist/build
creating dist/build/autogen
Preprocessing library cabal-exit-early-0.0.0...
("/usr/local/bin/ghc",["--info"])
("/usr/local/bin/ghc",["--info"])
creating dist/build
Environment: (removed)
("/usr/local/bin/ghc",["--interactive","-v","-fbuilding-cabal-package","-O0","-outputdir","dist/build","-odir","dist/build","-hidir","dist/build","-stubdir","dist/build","-i","-idist/build","-i.","-idist/build/autogen","-Idist/build/autogen","-Idist/build","-optP-include","-optPdist/build/autogen/cabal_macros.h","-package-name","cabal-exit-early-0.0.0","-hide-all-packages","-package-db","dist/package.conf.inplace","-package-id","base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57","-XHaskell98","A"])
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Glasgow Haskell Compiler, Version 7.6.3, stage 2 booted by GHC version 7.4.2
Using binary package database: /usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/package.conf.d/package.cache
Using package config file: dist/package.conf.inplace
wired-in package ghc-prim mapped to ghc-prim-0.3.0.0-d5221a8c8a269b66ab9a07bdc23317dd
wired-in package integer-gmp mapped to integer-gmp-0.5.0.0-2f15426f5b53fe4c6490832f9b20d8d7
wired-in package base mapped to base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.8.0.0-c2c1b21dbbb37ace4b7dc26c966ec664
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
*** gcc:
'/usr/local/bin/gcc-4.2' '-m64' '-fno-stack-protector' '-m64' '-L/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/base-4.6.0.1' '--print-file-name' 'libiconv.dylib'
Loading package base ... linking ... done.
*** Chasing dependencies:
Chasing modules from:
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep []
Upsweep completely successful.
*** Deleting temp files:
Deleting:
*** Chasing dependencies:
Chasing modules from: *A.hs
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep
[NONREC
ModSummary {
ms_hs_date = 2014-03-05 17:58:41 UTC
ms_mod = cabal-exit-early-0.0.0:A,
ms_textual_imps = [import (implicit) Prelude]
ms_srcimps = []
}]
*** Deleting temp files:
Deleting:
compile: input file A.hs
Created temporary directory: /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80134_0
*** Checking old interface for cabal-exit-early-0.0.0:A:
[1 of 1] Compiling A ( A.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
A.hs:1:11: Not in scope: `a'
Upsweep partially successful.
*** Deleting temp files:
Deleting: /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80134_0/ghc80134_0.o
Warning: deleting non-existent /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80134_0/ghc80134_0.o
Failed, modules loaded: none.
Leaving GHCi.
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting: /var/folders/f3/xd2xgjh90dx7t8npycqfd3kjrgnmbn/T/ghc80134_0
Linking...
Prelude>
Metadata
Metadata
Assignees
Labels
No labels
Activity
23Skidoo commentedon Mar 5, 2014
Does
cabal replwork with GHC 7.8 if you fix the compilation error? I see thatghcis not invoked with--interactivefor some reason.pikajude commentedon Mar 5, 2014
Yeah, it enters the REPL normally if there are no compilation errors. It also successfully stays in the REPL (as it should) if I introduce a compilation error, then
:r.23Skidoo commentedon Mar 5, 2014
OK, I'll look into this.
rehno-lindeque commentedon May 8, 2014
👍
TheunisKotze commentedon May 16, 2014
👍
spl commentedon Jun 5, 2014
I just switched 7.8.2 and ran into this problem as well. Any updates?
spl commentedon Jun 5, 2014
I see what you mean about not using
--interactive. Unfortunately, it's not possible to work around this:23Skidoo commentedon Jun 5, 2014
/cc @dcoutts
spl commentedon Jun 5, 2014
So I looked into it a bit.
cabal replrunsghc --makeand, if it succeeds, thenghc --interactive:I wonder if that is due to the line
if isGhcDynamic then do shared; vanillainDistribution.Simple.GHC.buildOrReplLibwith the context:Philonous commentedon Jun 7, 2014
replacing
if useDynToowith
seems to fix the issue
ivan-m commentedon Jul 10, 2014
@Philonous's solution seems to work for me.
23Skidoo commentedon Jul 11, 2014
It looks like fixing this is not as simple as skipping the
ghc --makephase inbuildOrReplLibwhen we're runningrepl.The comment before the
runGhcProg replOptsline says:So the
ghc --makestep is there on purpose:ghc --interactiverequires.cfiles (if any) to be built, which in turn may depend on auto-generated.hfiles, for producing which we need to runghc --makefirst. Note to self: would be nice to add a test case.23Skidoo commentedon Jul 27, 2014
Looking at this again, it seems like the original intention was to skip the compile step completely for
repland leave the .c -> .h dependency issue as a TODO.whenVanillaLibandwhenSharedLibare defined as:Which is why @Philonous's fix works: the
branch is a no-op when
forReplisTrue.But since for GHC 7.8
isGhcDynamicisTrueand it supports-dynamic-too, we just run therunGhcProg vanillaSharedOptsbranch, which doesn't check the value offorRepl. Which is why @joelteon was seeing different behaviour with GHC 7.8 and 7.6.gregwebs commentedon Aug 17, 2014
A workaround is to use --ghc-options="-fdefer-type-errors"
pikajude commentedon Sep 23, 2014
Not for, for example, names that aren't in scope.
codygman commentedon Nov 24, 2014
Any progress on this? I'm affected by it very regularly. That is, if I've correctly identified this is the reason for haskell/haskell-mode#349.