-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Hello!
I would like to make use of cabal-helper
to solve some problems that I am encountering when writing https://gitlab.com/tseenshe/hsinspect I hope you don't mind me creating a thread here for discussion (this is not a feature request or bug report as such).
-
I would like to have a launcher that can choose which one of multiple binaries to launch based on the current ghc version. e.g. say the user (or more likely the text editor behind the scene) installs
hsinspect-ghc-8.4.4
andhsinspect-ghc-8.6.5
and their current project is usingghc-8.4.4
then I would like to invokehsinspect-ghc-8.4.4
. I can do this with a hack usingcabal v2-exec ghc
and parsing the output string but that is tedious and I am interested in alternatives. Note that actually installing applications this way is not easy because--program-suffix
doesn't work duringv2-install
🤷♂️ -
Inside my program I would like to be able to provide a
FilePath
(the source file I am inspecting) and receive back aDynFlags
that is populated with anything relevant from the.cabal
andcabal.project
/cabal.project.local
. Most importantly are: default language, language extensions, compiler options. i.e.inferDynFlags :: FilePath -> IO DynFlags
. If you don't want to depend onghc
then I would be ok withString
s andLangExt.Extension
s and similar. -
I would like to be able to generate a packagedb that matches the most recent
v2-build
(or implied build from av2-run
orv2-install
) and set the correct environment variable, so that when I use theghc
api it is set appropriately. Note: I want to include the current package-inplace
even if it is not compilable. Ideally this would take the package and specific phase (application / library / test) into account, which would be far superior to the generated cabal.ghc.env.*
files. i.e.setupGhcEnv :: FilePath -> IO ()
. -
Without adding any more dependencies 😄 It is very important to me that I do not have a large depednency graph. I had hoped to be zero dependency (only
installed
things) to simplify and speed up the installation process (I was considering having my app be a single file that is compiled manually by directly invokingghc
!) So adding a dependency oncabal-helper
is already a big step for me. -
hie-bios
integration. Ideally I would like to be able to abstract these things across all build tools. I understand thathie-bios
plans to do that but I'd like to see it working reliably forcabal-install
first. Ifhie-bios
is going to have lots of big dependencies (e.g. on hpack or stack / yaml libraries) then that's a show stopper but perhaps I could put it behind a flag. // @mpickering