
26 Aug
2008
26 Aug
'08
10:45 a.m.
Is it allowed to write two different modules in a single file? Something like:
module Mod1 (...) where { ... }
module Mod2 (...) where { import Mod1; ... }
I tried, and got an error, but would like to confirm that there's no way to do that.
No, that's not possible because haskell will use the module name A.B.C to look the module up in path A/B/C.[l]hs. So using modules module A where .. module B where the compiler could only find one of them. (naming the file A.hs or B.hs) You have to use one file for each module I think there is another tool somewhere to merge many modules into one. But I don't think that's what you're looking for. (I haven't tried that myself) Marc Weber