For me the solution by K. A. Buhr didn't work. If I put a module name that doesn't match the file such as the proposed
-- in Client.hs
module Main where
I get the error "File name does not match module name". I also can't call the file Main.hs because there is already another file called Main.hs.
The only way to solve this was to use
-- in Client.hs
module Client where
add the lines other-modules: [] and - -main-is Client to the package.yaml:
executables:
ObjectServer:
main: Main.hs
other-modules: []
source-dirs: app
ghc-options:
- -threaded
- -main-is Main
dependencies:
- ObjectServer
Client:
main: Client.hs
other-modules: []
source-dirs: app
ghc-options:
- -threaded
- -main-is Client
dependencies:
- ObjectServer