Closed joel-bach closed 4 years ago
Super cool. Can you explain how the hs-boot files work?
The hs-boot files allow to break the import cycles as they contain data
and type
declarations without a body. GHC then compiles (where necessary, namely where the {-# SOURCE #-}
pragma appears in imports) the hs-boot to hi-boot and uses this file to compile the hs files in turn (see https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/separate_compilation.html#how-to-compile-mutually-recursive-modules).
In our case it allows the splitting of all (root) models into their own module even if they contain cyclic imports.
The compile performance on my computer is improved by around 20% (from 7 minutes to 5.6 minutes). With the .hs-boot files, there is no longer a big memory requirement for compilation.