FranklinChen / lh-plugin-demo

A small package that demonstrates how to use LiquidHaskell as a GHC plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LiquidHaskell as a GHC Plugin

This repo demonstrates how to use LiquidHaskell as a GHC plugin.

lh-plugin-demo.cabal shows

  • how to tell GHC to invoke the plugin
  • how to specify the relevant LH wrapper packages as dependencies

stack.yaml shows

  • how to point stack at the relevant LH repositories on hackage

stack.yaml.github shows

  • how to point stack at the relevant LH repositories on github

cabal.project shows

  • how to point cabal to the relevant LH repositories on hackage

cabal.project.github shows

  • how to point cabal to the relevant LH repositories on github

GHCi Integration

By virtue of being a plugin, you now get LH errors

  • when you (re)load in GHCi.

  • from all editor plugins based on ghci integration

GHCID

VSCode running ghcid in a terminal

ghcid

VSCode

VSCode with the Simple GHC (Haskell) Integration plugin

VS Code

Emacs

Doom/Emacs with dante

Vim

Vim/Neovim with ALE and the stack-build linter

Vim/Neovim with ALE and the stack-build linter

GHCID Integration

Additionally, ghcid produces LH errors on recompilation

For stack-based projects, run with

$ ghcid -c "stack ghci"

For cabal-based projects, run with

$ ghcid -c "cabal v2-repl"

Importing Specifications across Packages

The plugin also ensures that specifications written for one package are used when checking client packages. For an example, see the associated lh-plugin-demo-client package.

About

A small package that demonstrates how to use LiquidHaskell as a GHC plugin

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 100.0%