-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"cabal new-exec ghc" should work outside of .cabal projects #5895
Comments
See #5544 (comment) for a similar feature request for |
Because we cannot know for sure what compiler user will use in a
Then, however
wont work as environment variables are expanded too early. Maybe we could use shell aliases (when shell supports such), with
Would be nice, won't it? I think we can start implementing this by adding support for environment variables and aliases in project setting, and then generalise. Maybe it's easy to do all a once. Supporting |
note (please ignore if I'm stating the obvious) that In other words, PS: as for |
What's wrong with specifying the dependencies inside {- cabal:
build-depends: base, lens, lens-aeson, aeson, text
-}
{-# LANGUAGE QuasiQuotes, OverloadedStrings #-}
import Data.Aeson.Lens
import Control.Lens
import Data.Aeson
import qualified Data.Text as T
import Data.Aeson.QQ.Simple
import Data.Text.Lens
--- ... and so on You can run these anywhere outside a cabal project as |
|
|
Possibly stupid question: why not indeed run |
@michaelpj because e.g. of ghcjs. In fact I agree with @hvr, and tried to convince Ryan to use environment files based approach. Yet, until #5559 is fixed, that's a non-argument. |
@phadej can you expand on that? |
Ok. To fix my own comment: the expanding of environment variables is not a problem. You can create as cabal new-exec -w /some/local/ghc -b dep1,dep2,dep3 sh script.sh Then AFAICS the problem is to add |
related with the mega issue about a possible replacement of @RyanGlScott cabal script has been improved a lot in master, maybe they could help better in your workflow nowadays |
What in particular has changed about scripts in |
All thanks to the amazing work of @bacchanalia and there are workarounds (create a package, which you dont want i guess :-P ) over the multiple file thing see f.e.: https://github.com/haskell/haskell-language-server/blob/1.6.1.0-hackage/install.hs |
Ah, I was looking at the wrong place for Ultimately, the thing I care about the most (call it limitation (0), if you will) is having a mechanism for quickly compiling one-off files with a small number of Hackage dependencies that is more lightweight than setting up an entire I do think things could be even more lightweight, however. 99% of the time, all I really want to do is run something like
Certainly not insurmountable obstacles by any means, but there are some extra steps and cognitive overhead there. For this reason, I usually reach for In any case, that's my two cents on the issue. If the consensus is that what I'm asking for is an anti-pattern and that I should use |
to be fair to have an uniform interface is a good thing in its own
just checked and it continues being 10x slower so find the executable would be needed to speed up the thing:
The first one is optional only needed for the
I somewhat agree with some of the hvr and other maintainers arguments on the hackiness of |
Admittedly, I've never been able to figure out how |
well afaik the |
Nearly half my time in Haskell development is spend running
ghc
on individual files, outside of.cabal
projects, which might have some number of dependencies. Prevously, I could justold-install
all of my dependencies, pointghc
to the right file, and everything would Just Work™. Unfortunately, there isn't really anew-*
equivalent of this. There'scabal new-exec ghc
, but that assumes that you're in a.cabal
project, which usually isn't the case for me.Similarly to how you can run
cabal new-repl -b dep1,...,depn
outside of a.cabal
project today, I'd like to request thatcabal new-exec -b dep1,...,depn ghc -- Foo.hs
work outside of.cabal
projects. This would operate conceptually in a similar manner tostack exec ghc
.cc @phadej
The text was updated successfully, but these errors were encountered: