Comments (4)
The problem with cabal exec
is that it's slow, and in older versions, buggy (if there is any compile error it bails out rather than opening ghci with a compile error). What is the difference between cabal exec
and cabal repl
? Having arguments be :load
ed seems like a reasonable idea, and might have been enough in conjunction with cabal repl
to make your third command work.
from ghcid.
The problem with cabal exec is that it's slow
Well, that's mitigated by the fact that the whole point of ghcid would seem to be running the child GHCi process only once, so wrapping it in cabal exec
isn't going to hurt. [Day to day I am running the above command via a shell script:
$ cat ~/.local/bin/build
exec ghcid --command="cabal exec ghci $*"
$
thence build tests/ThoughtExperiment.hs
, (because I keep trying to do cabal exec ghcid
, which is wrong but seems reasonable)].
What is the difference between
cabal exec
andcabal repl
?
As far as I can tell, cabal repl
will only load a named section from the .cabal file (executable, test suite, or benchmark) and not just an arbitrary file — which does work with the pattern above
Having arguments be :loaded seems like a reasonable idea, and might have been enough in conjunction with cabal repl to make your third command work.
Quite possibly, but type checking ad-hoc scripts is where this is really shining for me for the moment, and lord knows having to enumerate each and every junk test program in your .cabal file just to repl it is tedious at best.
AfC
from ghcid.
One of the reasons I regularly stop/start my ghcid is to save my laptop battery, which I guess #26 is the real fix for. So I guess what we need is an algorithm to go from a directory with files in it, and optionally a list of files, to a command line and list of commands. Currently that algorithm is https://github.com/ndmitchell/ghcid/blob/master/src/Ghcid.hs#L51 and has no support for free command line arguments. It seems what you are suggesting is roughly:
- If you have a .cabal file in the directory, and no arguments, do
cabal repl
. - If you have a .cabal file in the directory, and some arguments, do
cabal exec ghci <arguments>
. - Otherwise, do
ghci <arguments>
Does that seem about right?
One thing that seems not to work with that is that if I import Paths_shake
into a module then cabal exec
doesn't work, but cabal repl
does. Any thoughts on how to avoid that?
from ghcid.
I've rewritten it, so now ghcid tests/Experiment.hs
works, which will do a cabal exec ghci tests/Experiment.hs
for you under the covers. Please let me know if there are still undesirable cases.
from ghcid.
Related Issues (20)
- Handle `-Wprepositive-qualified-syntax` and `-Wmissing-local-signatures` HOT 4
- stderr not displaying on Apple Silicon HOT 4
- Support JSON output HOT 1
- Can't open ghcid HOT 3
- ghcid is not showing any new output HOT 2
- ghcid --restart=dir closes when an error occurs HOT 2
- fsnotify 0.4.0 release breaks building ghcid HOT 1
- quickfix location can't be set to arbitrary directory HOT 4
- quickfix file fails to generate if stack exists unexpectedly HOT 1
- Support for cabal-install scripts?
- Start `ghcid` in VSCode extension
- Windows installation, ambiguous occurrence ‘wM_SETICON’ HOT 1
- Crash/incorrect error message on circular dependency HOT 2
- Option for auto restart with .hsc file
- Language.Haskell.Ghcid `showModules` incorrectly parses context information as module names (GHCi 9.4.4)
- emit warnings on the fly as a rebuild happens HOT 1
- cabal and stack install fails on Windows HOT 1
- VS Code Extension - "Ghcid has stopped" message leads to persistent error
- Windows 11 flags ghcid.exe as having trojan when built with stack HOT 2
- Fails to Start on WSL 2 HOT 4
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 ghcid.