7

I have a large Haskell project with many packages built with stack. I have long recompilation times when I make trivial changes in a core model or some configuration data without changing any types.

If this were C, I would have to only recompile the changed object file and then re-link the whole project. In Haskell I have to recompile every module which depends on the changed module.

I understand that this enables all kinds of compiler optimizations, but I am looking for a way to sidestep this in order to have quick recompilation during development. Is there any way to accomplish this in Haskell?

Cactus
  • 27,075
  • 9
  • 69
  • 149
ghorn
  • 614
  • 3
  • 11
  • It's not clear to me what sort of change you're referring to. Is a "core model" not a type? You might try splitting things up into smaller modules (as in e.g. the common `Foo/Types.hs` idiom) It sounds like you also want to disable optimizations during development. In modern GHC you can also just run the typechecker which is often what you want – jberryman Jan 08 '17 at 23:30
  • I mean like adding a print statement without changing the `IO ()` type, or changing some model parameter without changing the `Double` type. – ghorn Jan 08 '17 at 23:32
  • There is an open issue for `stack typecheck` here https://github.com/commercialhaskell/stack/issues/977 as well. Does disabling optimizations avoid recompilation or just speed up compilation? – ghorn Jan 08 '17 at 23:33
  • 1
    have you try `stack build --fast` ? – mb14 Jan 08 '17 at 23:45
  • Yes I am usually using `stack build --fast` – ghorn Jan 09 '17 at 01:27
  • 4
    Do you have a minimal example that illustrates the problem? I am not able to duplicate it in the simple example of one module depending on a `Double` parameter defined and modified in separate module. Providing I always build with `--fast`, only the modified module gets rebuilt. – K. A. Buhr Jan 09 '17 at 01:54
  • 1
    You are right, I cannot reproduce it with --fast. I must have been measuring incorrectly before. – ghorn Jan 09 '17 at 23:20

0 Answers0