
The attached program fails to compile despite it being a close copy of that shown in the Reference: comments. The ghci invocation results in: ================================ ~/prog_dev/haskell/my-code $ ghci Modules.hs GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling Test ( Modules.hs, interpreted ) Modules.hs:12:0: parse error on input `module' Failed, modules loaded: none. Prelude> :q Leaving GHCi. ================================== What should change to allow compilation? TIA. -Larry

On Sat, Nov 13, 2010 at 8:20 AM, Larry Evans
The attached program fails to compile
To the best of my knowledge, GHC doesn't support defining multiple modules in the same file. If you move each module to its own file, it should compile. /g -- "I’m surprised you haven’t got a little purple space dog, just to ram home what an intergalactic wag you are."

On Sat, Nov 13, 2010 at 10:20:31AM -0600, Larry Evans wrote:
The attached program fails to compile despite it being a close copy of that shown in the Reference: comments. The ghci invocation
Reference: First code example here: http://www.haskell.org/onlinereport/haskell2010/haskellch5.html#x11-980005
Note the distinction between a Haskell *program* (as defined in that section of the Report) and a *file* on your file system. A "program" as defined in the Report is an abstract entity consisting of a collection of modules; the relationship between programs and files is not specified. As it happens, GHC does not support having multiple modules in the same file, although it is conceivable that another compiler might (although I do not know of any). -Brent
participants (3)
-
Brent Yorgey
-
J. Garrett Morris
-
Larry Evans