Re: [Haskell-cafe] Template Haskell: hiding declarations

2010-10-04 Thread Vo Minh Thu
2010/10/4 Jonas Almström Duregård jonas.dureg...@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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell: hiding declarations

2010-10-04 Thread Liam O'Connor
Perhaps try importing the huge module with lots of imports in another
module, and then only export the ones you want.

Cheers.
~Liam



2010/10/4 Vo Minh Thu not...@gmail.com:
 2010/10/4 Jonas Almström Duregård jonas.dureg...@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@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe