[Haskell-beginners] constant set
Brandon Allbery
allbery.b at gmail.com
Sun Mar 11 04:41:10 CET 2012
2012/3/10 Ovidiu Deac <ovidiudeac at gmail.com>
> I already tried this approach:
>
> module Main where
>
> import ....
>
> module Colors where
> red = 1
> blue = 2
> .....
>
> but the compiler complains at the line "module Colors where". It says:
> parse error on input `module'
>
Right, you can have only one module per file. You would define them in a
separate file, possibly making use of qualified imports:
> module Constants.AColors where
> red = 1
> blue = 2
> module Constants.BColors where
> yellow = 1
> red = 2
> module Main where
> import qualified Constants.AColors as AC
> import qualified Constants.BColors as BC
> ...
> -- code that uses AC.red and BC.red
This is not entirely ideal from the standpoint of using types to help
manage your data, but without more details as to how you're using them,
it's hard to present appropriate solutions.
--
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120310/205677e5/attachment.htm>
More information about the Beginners
mailing list