I'm writing a snake game in Haskell. These are some of the things I have:
- A
Coorddata type - A
Linedata type - A
Rectdata type - A
Polygontype class, which allows me to get aRectas a series of lines ([Line]). - An
Impassabletype class that allows me to get aLineas a series of Coords ([Coord]) so that I can detect collisions between otherImpassables. - A
Drawtype class for anything that I want to draw to the screen (HSCurses). - Finally I'm using QuickCheck so I want to declare
Arbitraryinstances for a lot of these things.
Currently I have a lot of these in separate modules so I have lots of small modules. I've noticed that I have to import a lot of them for each other so I'm kind of wondering what the point was.
I'm particularly confused about Arbitrary instances. When using -Wall I get warnings about orphaned instances when I but those instances together in one test file, my understanding is that I can avoid that warning by putting those instances in the same module as where the data type is defined but then I'll need to import Test.QuickCheck for all those modules which seems silly because QuickCheck should only be required when building the test executable.
Any advice on the specific problem with QuickCheck would be appreciated as would guidance on the more general problem of how/where programs should be divided into modules.