Sorry this is a dumb question, but I cannot figure out how to put multiple modules in the same file. Suppose the file is named A.hs. If I put module B first, i.e.
module B where ...
module A where ...
it complains that it expected A when I run “ghci A” (It’s not top-level, so I don’t want to call “ghci A.hs”). The other way around, and it complains “parse error on input module”).
There’s a related bug here, http://hackage.haskell.org/trac/ghc/ticket/2428 . Is there actually no way to get this, even if the other module is only used locally?
You cannot have multiple modules in the same file. The bug you linked to is just about the error message given by GHC not being clear about this.
However, if you’re using Cabal, you can still control the visibility of modules by putting the modules you want visible to users in the
Exposed-Modulessection, and putting any internal modules inOther-Modules.