separate class and type namespace
cgibbard at gmail.com
Tue Jan 31 14:22:05 EST 2006
> On the other hand, it is recommended
> practice to define only one data type per module, isn't it?
Only by very few people as far as I know. I know that Henning
Thielemann advocates this, but it seems like a rather arbitrary
restriction to me. I find it quite common to define several data types
in a single module, so long as they're sufficiently related. Depending
on how they are used, I may or may not export any one of them.
Have a look at Basics.lhs in Haskore, then imagine separating that
such that every one of those data types was in its own module. You'd
end up with a lot of modules which only had one data type in them and
nothing else. I think it's just better to use your own picture of how
the project fits together to decide where to put things. Unless you're
explicitly using modules for hiding data constructors, it doesn't seem
necessary to structure your modules around your types.
More information about the Haskell-prime