Nix Notes: Overriding Haskell Packages

Setup In one of the projects, I use a pinned version of nixpkgs based on miso. There are two advantages to that, one is that I know that miso builds with that version, and the second one is that I can take advantage of miso’s cachix cache and not compile everything from scratch. In the most basic form, it looks like this. File nixpkgs.nix: let bootstrap = import <nixpkgs> {}; misoTarball = bootstrap.
Read more...

Quick Haskell Trick

The Haskell REPL (Read Print Eval Loop) - GHC interpreter, ghci invoked with: $ ghci or: $ stack repl or: $ cabal new-repl or: $ cabal repl is an environment enabling fast iteration. You can test a particular function and that’s cool and all, but you can also run an entire program in the interpreter. You do that with: ghci> :main or ghci> main The flow is as follows:
Read more...

Debugging a Safe Module

TL;DR: change -XSafe to -XTrustworthy. I’ve found myself needing to add some trace statements to System/Environment.hs. The module is marked Safe, so when you try to: import Debug.Trace (trace) you get the following error: Debug.Trace: Can't be safely imported! The module itself isn't safe. I don’t know anything about Safe Haskell and I didn’t want to learn at the time. Removing {-# LANGUAGE Safe #-} made the Safe modules depending on System.
Read more...