Build, cabal and tooling
Twelve lessons on the build: a Haskell project with cabal, offline; a library, an executable and a test suite in one .cabal file; the GHC flags, the Core that -ddump-simpl prints, and the profiling libraries this image does not have. The debugger follows, in GHCi and in Debug.Trace, then the language editions and the old code they explain, and a run timed five times.
070
A Cabal project, offline
cabal init in a folder, the .cabal file, cabal build --offline, what needs the network
Open
071
A library, an executable and a test suite
library, executable, test-suite exitcode-stdio-1.0, boot libraries only
Open
072
Running the test suite
cabal test --offline, the exit status of a suite, a failing suite
Open
073
GHC flags
-O0, -O1, -O2, -Wall, -Werror, -fno-code, -v, -ddump-timings
Open
074
Reading -ddump-simpl
-ddump-simpl, -dsuppress-all, a tiny function and its Core, what to look for
Open
075
Profiling and why it is not here
-prof and the real error, the profiling libraries a system package would add
Open
076
Debugging in GHCi
:break, :continue, :step, :trace, :print, a breakpoint on a function
Open
077
Debug.Trace
trace, traceShow, traceM, why the order of output surprises, when to delete it
Open
078
gdb and a Haskell binary
-g, a breakpoint in the RTS, why gdb shows little of a lazy program, what to use instead
Open
079
Haskell 2010 against GHC2021
default-language, the extensions GHC2021 turns on, Haskell2010 code
Open
080
Reading old Haskell
String everywhere, Data.Map as Map, fail in a monad, the AMP change, an old module modernised
Open
081
Measuring performance
/usr/bin/time, a warm-up run, five runs, min and median, +RTS -s, the machine line
Open