A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://docs.haskellstack.org/en/stable/commands/ghci_command/ below:

ghci - Stack

The stack ghci and stack repl commands
stack ghci [TARGET/FILE] [--pedantic] [--ghci-options OPTIONS]
           [--ghc-options OPTIONS] [--flag PACKAGE:[-]FLAG] [--with-ghc GHC]
           [--[no-]load] [--package PACKAGE] [--main-is TARGET]
           [--load-local-deps] [--[no-]package-hiding] [--only-main] [--trace]
           [--profile] [--no-strip] [--[no-]test] [--[no-]bench]

A read–evaluate–print loop (REPL) environment takes single user inputs, executes them, and returns the result to the user. GHCi is GHC's interactive environment. The stack ghci or stack repl commands, which are equivalent, allow you to load components and files of your project into GHCi.

The command accepts the same TARGET syntax as stack build. By default:

It is also possible to specify a module source code file. For example:

Stack will identify which component the file is associated with, and use the options from that component.

Pass the --package option to load GHCi with an additional package that is not a direct dependency of your components. This option can be specified multiple times.

Pass the option --flag <package_name>:<flag_name> or --flag <package_name:-<flag_name> to set or unset a Cabal flag. This option can be specified multiple times. The same Cabal flag name can be set (or unset) for multiple packages with:

Note

In order to set a Cabal flag for a GHC boot package, the package must either be an extra-dep or the package version must be specified with the --package option.

By default:

Stack combines all of the GHC options of components.

Note

Combining GHC options should work out when packages share similar conventions. However, conflicts may arise, such as when one component defines default extensions which are not assumed by another. For example, specifying NoImplicitPrelude in one component but not another is likely to cause failures. GHCi will be run with -XNoImplicitPrelude, but it is likely that modules in the other component assume that the Prelude is implicitly imported.

stack ghci configures GHCi by using a GHCi script file. Such files are located in subdirectories of <XDG_CACHE_HOME>/stack/ghci-script, where <XDG_CACHE_HOME> refers to the XDG Base Directory Specification for user-specific non-essential (cached) data.

Unix-likeWindowsWindows (Command Prompt)

The default for <XDG_CACHE_HOME> is $HOME/.cache.

On Windows, the default for <XDG_CACHE_HOME> is $Env:LOCALAPPDATA.

On Windows, the default for <XDG_CACHE_HOME> is %LOCALAPPDATA%.

Running plain GHCi

stack ghci always runs GHCi configured to load code from packages in your project. In particular, this means it passes in flags like -hide-all-packages and -package-id= in order to configure which packages are visible to GHCi.

For doing experiments which just involve packages installed in your databases, it may be useful to run GHCi plainly like:

This will run a plain GHCi in an environment which includes GHC_PACKAGE_PATH, and so will have access to your databases.

Note

Running stack ghci on a pristine copy of the code does not currently build libraries (issue #2790) or internal libraries (issue #4148). It is recommended to always use stack build before using stack ghci, until these two issues are closed.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4