Linking Smaller Haskell Binaries
https://brandon.si/code/linking-smaller-haskell-binaries/
#HackerNews #Haskell #Binaries #Smaller #Binaries #Programming #Efficiency #Code #Optimization
Linking Smaller Haskell Binaries | Brandon Simmons' website
Haskell binaries can get quite large (think ~100MB), especially for projects with many transitive dependencies. Here are two strategies that can help at link time, the latter being more experimental. I used the test-pandoc binary from pandoc on GHC 9.2.5 below. This was nice because obviously it was easy to test if linking broke anything (just run the tests). -split-sections and --gc-sections You can instruct ghc to emit code in individual minimal sections, allowing the linker to easily find and remove dead code. This looks like, in your cabal.project:





