[Haskell-cafe] Template Haskell: hiding declarations

Liam O'Connor liamoc at cse.unsw.edu.au
Mon Oct 4 08:25:45 EDT 2010

Perhaps try importing the huge module with lots of imports in another
module, and then only export the ones you want.


2010/10/4 Vo Minh Thu <noteed at gmail.com>:
> 2010/10/4 Jonas Almström Duregård <jonas.duregard at chalmers.se>:
>> Hi Café,
>> I'm doing some code generation with Template Haskell that results in
>> few hundred top level declaration, of which only 10 or so should
>> actually be exposed to the user (the rest are only used by generated
>> code).
>> Since I cant splice stuff into the module header (i.e. into the export
>> list), I cant think of a good way to hide the internal declarations.
>> One way would be to put all the declarations into one or several
>> where-clauses, but this doesn't work very well when several functions
>> share the hidden declarations. Also I might want to hide a few data
>> types.
>> Does anyone have a clever solution? Has anyone had a similar problem
>> (maybe TH needs to be extended with support for hidden declarations)?
> Maybe this, although I guess this is what you mean by "doesn't work very well":
> (a,b,c,d,...) = (a,b,c,d,...) -- those areyour top-level declarations
>  where
>  a = ...
>  b = ...
>  c = ...
>  d = ...
>  ...
>  all you other code
> Cheers,
> Thu
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list