Skip to content

Project Configuration

dramforever edited this page Mar 18, 2021 · 1 revision

In vscode-ghc-simple v0.2.x, the New BIOS mechanism (i.e. vgs-bios) has basic support for multi-component/multi-package projects.

There are currently three ways to configure this your project so that the extension knows how to load it. In priority order, they are: (Earlier ways override later ones.)

  • replCommand
  • hie.yaml
  • Implicit configuration

In the order of most recommended first, your options for configuring your project are:

Using hie.yaml (Recommended)

Create a file called hie.yaml in your project root, and configure it based on hie-bios documentation.

Examples taken from hie-bios documentation, shortened for breivity:

cradle:
  cabal:
    - path: "./src"
      component: "lib:hie-bios"
    - path: "./exe"
      component: "exe:hie-bios"
    # More components
cradle:
  stack:
    - path: "./src"
      component: "hie-bios:lib"
    - path: "./exe"
      component: "hie-bios:exe:hie-bios"
    # More components

We currently support stack and cabal cradles, and multi for choosing between.

An hie.yaml file is already present in many projects, due to the popularity of the Haskell Language Server. If the configuration only uses a simple Stack or Cabal cradle (which is the most common case), it should already be usable with vscode-ghc-simple v0.2.x.

Legacy configuration: replCommand

You can use ghcSimple.replCommand as before, but it cannot handle multiple components or packages in a same project.

The configuration ghcSimple.replCommand available in v0.1.x should still work. If set, it should be a string containing a command that, when run under the working directory of the workspace, starts a GHCi session with the correct environment.

The configuration ghcSimple.replScope defines whether a GHCi session is started for the entire workspace, or for each file. There is unfortunately no more granular configuration.

If ghcSimple.replCommand is set to anything other than the empty string, this overrides the other configuration methods.

Implicit configuration

If neither of the options mentioned before is used, vscode-ghc-simple will attempt to detect the type of project being used. It currently supports starting cabal repl and stack repl. This should provide a similar effect to those who used vscode-ghc-simple v0.1.x without configu

Note that detection of what target to use for the REPL session is unsupported.

Removed: workspaceType

ghcSimple.workspaceType was deprecated, and now has no effect. Please consider other options. You will be shown a warning if a set ghcSimple.workspaceType is detected and will be prompted to remove it.