Skip to content

hsinspect requirements #75

@tseenshe

Description

@tseenshe

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).

  1. 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 and hsinspect-ghc-8.6.5 and their current project is using ghc-8.4.4 then I would like to invoke hsinspect-ghc-8.4.4. I can do this with a hack using cabal 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 during v2-install 🤷‍♂️

  2. Inside my program I would like to be able to provide a FilePath (the source file I am inspecting) and receive back a DynFlags that is populated with anything relevant from the .cabal and cabal.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 on ghc then I would be ok with Strings and LangExt.Extensions and similar.

  3. I would like to be able to generate a packagedb that matches the most recent v2-build (or implied build from a v2-run or v2-install) and set the correct environment variable, so that when I use the ghc 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 ().

  4. 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 invoking ghc!) So adding a dependency on cabal-helper is already a big step for me.

  5. hie-bios integration. Ideally I would like to be able to abstract these things across all build tools. I understand that hie-bios plans to do that but I'd like to see it working reliably for cabal-install first. If hie-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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions