Comments (11)
This is likely the same issue that intero
had to work around: if you load the same file twice in ghci
, and it has warnings but not errors, ghci
does not report the the warnings the second time it is loaded.
from dante.
Ok, I take it back - that change just made it so that the warnings don't disappear if I save the file immediately after some changes, which they did before... So I'm back to 'no idea where the problem is'. I guess I can work around it by not saving the file immediately after some changes, which I do by reflex now after some unpleasant experiences with crashing APL environments.
from dante.
from dante.
@zarybnicky We subsequently changed the code for that, so be sure to check out how it works in the latest intero
. It's unfortunate that it adds some complexity.
from dante.
As often, I would recommend bringing this issue to the attention of the GHCi maintainers.
Furthermore, the speed of the checker would be impacted by doing anything else than a simple reload. (And in general I hate increasing the complexity just to work around upstream issues.)
from dante.
The reliable fix is here: chrisdone-archive/intero#468
GHCi doesn't report warnings because you changed the file too rapidly, below <1 second duration. So in reporting whatever the last warnings were, if your users make a change too rapidly, then it'll report warnings for old code. I had this situation in Intero. The change in 62c3057 will report incorrect warnings sometimes.
from dante.
@chrisdone This does not seem to happen with my setup. What is the sequence of steps to reproduce the bug?
from dante.
It's GHCi behavior:
bash-3.2$ cat > input.txt
:set -Wall -fobject-code
:!echo "x = 'a'" > x.hs
:l x.hs
:!echo "y = 'a'" > x.hs
:l x.hs
:q
bash-3.2$ cat input.txt | ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude> Prelude> [1 of 1] Compiling Main ( x.hs, x.o )
x.hs:1:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature: x :: Char
Ok, modules loaded: Main (x.o).
Prelude Main> Prelude Describe Main> Ok, modules loaded: Main (x.o).
Prelude Main> Leaving GHCi.
Notice there is no warning about y
despite the fact that we changed the file. In your commit, it will report that there's no top-level binding for y
(because you're caching the old results).
You can also miss error messages due to this:
bash-3.2$ cat > input-no-errors.txt
:set -Wall -fobject-code
:!echo "x = 'a'" > x.hs
:l x.hs
:!echo "y = 'a' * k" > x.hs
:l x.hs
:q
bash-3.2$ cat input-no-errors.txt | ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude> Prelude> [1 of 1] Compiling Main ( x.hs, x.o )
x.hs:1:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature: x :: Char
Ok, modules loaded: Main (x.o).
Prelude Main> Prelude Describe Main> Ok, modules loaded: Main (x.o).
Prelude Main> Leaving GHCi.
There should be a type error or an out of scope error about k
. There isn't because we changed the file too quickly. This happened to me a lot in Intero until I fixed it. We can put a delay before writing the file and then it works properly:
bash-3.2$ cat > input-delay.txt
:set -Wall -fobject-code
:!echo "x = 'a'" > x.hs
:l x.hs
:!sleep 1
:!echo "x = 'a' * k" > x.hs
:l x.hs
:q
bash-3.2$ cat input-delay.txt | ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude> Prelude> [1 of 1] Compiling Main ( x.hs, x.o )
x.hs:1:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature: x :: Char
Ok, modules loaded: Main (x.o).
Prelude Main> Prelude Main> Prelude Main> [1 of 1] Compiling Main ( x.hs, x.o )
x.hs:1:11: error: Variable not in scope: k :: Char
Failed, modules loaded: none.
Prelude> Leaving GHCi.
For whatever reason in the GHC API, it ignores files that have changed in <1 second since the last modification.
Editing with flycheck turned on will trigger this a lot. If you just type check on a key binding or file save, you won't notice it that often.
from dante.
Thanks for the detailed information. I confirm that I am not observing this problem with my version of GHCi (8.0.2) on linux (nixos).
from dante.
It might be an OS X behavior then.
from dante.
from dante.
Related Issues (20)
- Crash upon opening .hs file HOT 7
- Donations/sponsorships? HOT 2
- Jump to definition and Info unreliable. Configuration of test targets hard to get right HOT 13
- Error while checking syntax automatically: (error "Buffer *dante:<name>::<path>/* has no process") HOT 1
- Tooltip errors don't display hole fits every time HOT 1
- hlint-enabling snippet adds haskell-hlint many times
- Dante forgets directory variables (dante-methods) from time to time HOT 1
- Problem with global-flycheck-mode enabled HOT 1
- dir-local dante-target HOT 6
- Bad formating if no newline present
- Unable to get dante working with SimulaVR HOT 2
- How is this related to the haskell-language-server? HOT 2
- Setting up Dante Targets for enabling jump to definition and repl HOT 1
- Using Dante with stack script HOT 9
- Support for Emacs 27 dropped in 6d212f3 HOT 5
- Warnings and errors disappear after asking flycheck to reload unchanged buffer. HOT 1
- Complains about no loading method applies, even if all variables are set.
- dante doesn't install with Aquamacs
- Corfu integration
- "These modules are needed for compilation but not listed in your .cabal" error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dante.