Getting a M1 Max MacBook Pro, I had to figure out how to install all the software I had on my old Intel Mac. One of the most challenging was LiquidHaskell. Here are the instructions for others to save some time.
brew install z3 z3 --version # Z3 version 4.8.14 - 64 bit
Install LLVM 12
Because of this bug in homebrew’s LLVM 13 that solves other problems, we need LLVM 12.
brew install llvm@12
Install latest version of stack.
The stable version of stack will not install GHC on OSX arm installations. To overcome that, we need to install the latest version.
brew install --HEAD stack
Setup a Demo Repository
I recommend using this scaffold project to get LiquidHaskell running on the command line and VS Code. It might work on other editors, but I have not tested them.
git clone https://github.com/alcides/lh-plugin-demo.git cd lh-plugin-demo stack build stack ghci
This last line should open ghci, doing all the liquid type verifications necessary. You should see two green lines with 1 and 3 constraints checked, respectively.
You can do the exercise of editing
src/Demo/Lib.sh and changing
x + 1 to
x - 1 and running the command again. You should now see an error.
Now that we have error reporting on the command-line, we can move to the more convenient code editor. In my case that means VSCode1.
The first step is to uninstall all Haskell plugins. Just trust me on this, they are all pretty much incompatible with each other, except when they aren’t. Now you need to install Simple GHC (Haskell) Integration. On the CLI:
brew install visual-studio-code code --install-extension dramforever.vscode-ghc-simple
However, this will not work for a M1-unrelated reason: LiquidHaskell and Haddock are not compatible (unfortunately). So the first step is to disable it.
Settings > Extensions > GHC Simple config > Ghc Simple > Startup Commands and remove
Cmd+shit+P and select
GHC: Restart GHCi Sessions if it doesn’t restart on its own.
And now you should have localized errors in your Haskell files.
1Textmate’s support for Haskell is pretty minimal. Stack and Cabal support is completely missing.