[Haskell-cafe] how to generate source code from TH Exp?

Felipe Almeida Lessa felipe.lessa at gmail.com
Thu May 12 19:14:09 CEST 2011


On Thu, May 12, 2011 at 2:04 PM, Stefan Kersten <sk at k-hornz.de> wrote:
> extractModules = sort . nub . everything (++) ([] `mkQ` f)
>     where f (NameQ x) = [modString x]
>           f (NameG _ _ x) = [modString x]
>           f _ = []

Minor nitpick:  instead of doing 'sort . nub', please use 'import
qualified Data.Set as S' and do 'S.toAscList . S.fromList'.  This
should be a lot faster.

Cheers, =)

-- 
Felipe.



More information about the Haskell-Cafe mailing list