The main package manager to use in Haskell is Cabal. Make sure that the Cabal version that you are using is at
least 3.0. Then build
, repl
, install
, etc will use the upgraded v2-style versions that work with minimal problems.
Have you ever tried :doc
on something only for GHC to tell you that -haddock
wasn't enabled?
The way to fix this is to add -haddock
to every installed cabal package. Edit ~/.cabal/config
and uncomment the
ghc-options:
option under program-default-options
and add the -haddock
flag. The resulting file should look like:
program-default-options
ghc-options: -haddock
The next time you build, GHC will rebuild your packages with haddock enabled. Then you will be able to look at documentation with :doc
.
To add modules into the repl, type :m +module
or import module
. To remove modules from the repl, type
:m -module
. Qualified imports can be removed this way also. When loading modules, if you prefix the module with *
(like :load *module
) then you can autocomplete all functions and qualified imports as if you were in that module.
The best way I've found to use hoogle is to just run hoogle generate
and have it build all the installed packages.
The option for only building local packages is too complex to use and doesn't seem to capture all of them. To look at
the documentation of the first Hoogle result run hoogle query -i
. To help constrain the result to a specific module, run hoogle Module.function
.
If you use stack
instead of cabal
then you can generate local hoogle databases and query them. Use stack hoogle
to generate a local database and stack hoogle query
to query it.
The best way to use ghcid is to add a .ghcid
file in your cabal project that looks like this:
--restart=project.cabal -c cabal v2-repl
That way, when you modify your cabal file ghcid will automatically rebuild your project.
If you want packages that depend on git repositories add a cabal.project
file that looks like this
in the same folder as the project:
packages: .
source-repository-package
type: git
location: github url
tag: commit hash
Options for source-repository-package
are here.
The package manager for Purescript is Spago. To install it, clone the git repository and run stack install
(this works without needing a newer version of glibc).
To generate documentation for your project and its dependencies run spago docs
. Then you can search the documentation
with spago search
.
Pscid is the Purescript version of Ghcid, and later versions of it also work with Spago. When updating dependencies, you can go into Pscid and type b
to trigger a build and r
to restart Pscid.
The package manager to use is quicklisp. To create a new project, you need to have sbcl and quicklisp installed. Then inside sbcl run:
(ql:quickload "cl-project")
(cl-project:make-project #P"./path-to-project/root/")
The project should be in the path ~/common-lisp
so that quicklisp can detect it. Then to load your project in slime, type
(ql:quickload :project-name)
. Then you can evaluate files inside your project with all the dependencies included.
In order to store documentation for the core of lisp offline, you have to download HyperSpec. Do this by running this command inside sbcl:
(ql:quickload "clhs")
Then inside emacs with slime if you type C-c C-d h
it will open the browser to the offline documentation
for the symbol your cursor is currently on.
M-x slime
: Start slimeC-x d
: Enter dired (to change files)C-x o
: Switch buffers in split window (switching between slime and your code)C-x b
: Switch buffers (allows you to switch back to the code window if the debug window obscured it)C-c C-z
: Open SLIME REPL (useful when a REPL accidentally gets closed but SLIME is still active)C-M-x
: Evaluate lisp expressionC-c C-c
: Recompile a lisp function (useful for fixing the code on the fly)C-c C-r
: Evaluate selected region of text (useful for readtable stuff like array infix operations)C-c C-k
: Evaluate whole fileC-c M-t
: Trace function at cursorC-c M-m
: Expand macroC-c Shift-t
: Open SLIME trace dialogC-c Shift-i
: Inspect value at cursorM-.
: Jump to function definition
Add a (break)
statement to enter the debugger. Then you can choose a stack frame and press r
to restart that stack frame or s
to step in that stack frame.
Pressing e
in a stack frame allows you to evaluate arbitrary code in a stack frame. This allows you to modify local parameters in a stack frame.
Pressing i
on a local parameter opens up the parameter's value in the inspector.
Pressing v
on a stack frame jumps to the source code where the exception was created.
C-h m
: Shows all keybindingsC-M-y
: Insert unicode lambda symbolC-c C-d
: View documentation for symbol on cursorC-c C-k
: Load fileC-M-x
: Send expression to REPLC-c C-r
: Send region to REPLC-c C-e r
: Expand macro region with stepper
Run pip install mypy
inside env terminal to install mypy for a project.
Install the dropbox mypy plugin, go to Mypy Terminal (should be next to Python console), right click the plugin
window, and select Configure plugin...
, then type in ./venv/bin
into PATH suffix (for Linux).