sharing datatypes : best practice ?

Jan Kort kort@science.uva.nl
Thu, 10 May 2001 16:36:25 +0200


"Taesch, Luc" wrote:
> 
> i ve developped a datatype in a module P, and another module will use it, and most probably a few others, and its quite central to the apps Im building.
> 
> what is the best organisation ?
> 
> -import module P everywhere
> - isolate this datatype in a module, which would be imported everywhere ?(very "include like")
> - merging the module around this datatype ?
> 
> this last option  is not a good option here as :
> - this would be too big
> - P is generated by Happy.

Hi Luc,
Isolating the datatype in a module is what I always do.
Only "Main.hs" calls the happy parser and just about
every module uses the datatype, so it makes sense to
separate them.

  Jan