File not created
Are you sure? I expect at least Comma.o and Comma.hi . The former contains compiled code ready to connect to the executable, and the latter contains the interface information that ghc uses for typecheck modules that import the Comma module.
However, ghc will only bundle compiled modules into an executable file if there is a main function. By default, this means a function named main in a module named main . If you do not provide an explicit module name, this is assumed to be main , and why your test works when you delete the module Comma where .
To compile and link the Comma.hs file, you can use module Main where instead of module Comma where , or you can use the -main-is flag to tell ghc that Comma.main should be the main function:
ghc --make -main-is Comma Comma.hs
Or:
ghc --make -main-is Comma.main Comma.hs
source share