ghcide
Starter Project
This starter project for ghcide
uses nix to provide a local shell environment with:
- niv
- ghcide
- cabal-install
- hlint
- stylish-cabal
- stylish-haskell
- pointfree/pointful
A pre-made cabal project is included with a sample library, binary, and test-suite. The test suite is a simple tasty example using hunit
and smallcheck
. The project is licensed as MIT. I encourage people to use MIT's permissive license for open source software, but feel free to use any license you want.
Setup
Project Structure
The project is structured as follows
bin/ - executable source files
nix/ - nix files and niv version pinning
/nixpkgs.nix - Custom nixpkgs for project
/sources.json - (autogenerated) niv sources metadata
/source.nix - (autogenerated) version pinned nix projects via niv
src/ - library source files
test/ - test-suite source files
.gitignore - tells git ot ignore artifacts produced by cabal, nix, and vscode
.hlint.yaml - Default hlint config
.stylish-haskell.yaml - Default
CHANGELOG.md - changelog generated by cabal
default.nix - release package for nix
ghcide-starter.cabal - cabal Project file
hie.yaml - hie configuration for ghcide
LICENSE - MIT project license
README.md - this document
shell.nix - nix shell configuration with ghcide support
Steps
Search through the project and replace "ghcide-starter" with your project's name. The files that need editing are
-
CHANGELOG.md
- Replace
ghcide-starter
with your project's name
- Replace
-
default.nix
- Replace
ghcide-starter
with your project's name
- Replace
-
ghcide-starter.cabal
- Author/maintainer fields
- the executable is named
myapp
- the test suite is named
mytest
- the executable depends on
ghcide-starter
-
hie.yaml
- Replace
ghcide-starter
with your project's name
- Replace
-
LICENSE
- fill out
<YEAR>
and<NAME>
- fill out
-
nix/nixpkgs.nix
- replace the
ghcide-starter
haskell package override with the your project's name
- replace the
-
README.md
- Write your own!
-
shell.nix
- Replace all instances of
ghcide-starter
with your project's name - Add additional build tools to
buildInputs
- Replace all instances of
Recommend Visual Studio Code Plugins
This project works exceptionally well with the following vscode plugins
Unfortunately, the hlint
plugin for vscode is severely outdated and unmaintained. However, there is talk of integrating hlint directly into ghcide.