Stack to Elm Them All

Ever wondered - or forgot - how to build the Elm Compiler with tracing using Haskell Stack? Here’s how you do it

Init with stack

stack init --resolver lts-11.20

Add options in elm.cabal:

Executable elm
    if flag(dev)
        ghc-options: -O0 -Wall -Werror -rtsopts -eventlog

Build with stack:

stack build --flag elm:dev --profile

Run with RTS options:

elm make ./src/Main.elm \
    --output=./dist/app.js +RTS -xc -lu -RTC \
    2>eventlog_readable.log

This is essentially just a reminder for me on how to do it that I wanted to preserve from death-by-slack-history.

Might also be useful

lsb_release -a
uname -a
stack --version