Why cabal tool doesn't use Setup.lhs/Setup.hs?
build-process, cabal, haskell
Solution
You most likely have
build-type: Simple
in your `.cabal` file. If you select the `Simple` build type, you essentially promise that your `Setup` file does nothing but invoke `defaultMain`, and the `cabal` binary will not invoke it. If you want to ensure that your `Setup` file is run every time, then change the line to
build-type: Custom
You also ask about the rationale for requiring the `Setup` file anyway: actually, it isn't required if you use the `Simple` build type. The `cabal` binary will happily configure and install it without. However, it is considered good style to include a `Setup` file for any package, because it will allow users to install the package who have the `Cabal` libary available, but not the `cabal-install` tool (and Hackage enforces the presence of a `Setup` file for this reason).
Problem
I've added a `putStrLn "Hello"` line into `main` function of my Setup.lhs and was expecting to see it when running `cabal configure` or `cabal build`. But i did not. Then i've compiled `Setup.lhs` with `ghc --make` and ran `./Setup configure` and the line was shown. If it's done intentionnaly, i don't see rationale behind this and even need in `Setup.lhs` file at all. Can you clear these things for me?