RFC: template-haskell & Data.Map vs. Prelude.lookup use

Richard Eisenberg eir at cis.upenn.edu
Thu Apr 24 13:04:55 UTC 2014


That map seems to store the set of variables during printing TH, for the purposes of disambiguating identifiers with the same name but different uniques. If blatting out a whole lot of program text, I could imagine the Map getting somewhat sizeable.

But, it seems to only need the lookup and insert operations... is there a simpler data structure that has only these operations efficiently?

Richard

On Apr 24, 2014, at 3:43 AM, Herbert Valerio Riedel <hvriedel at gmail.com> wrote:

> Hello *,
> 
> In order to address
> 
>  https://github.com/haskell/cabal/issues/1811
> 
> I've prepared a commit for review at
> 
>  https://git.haskell.org/ghc.git/commitdiff/refs/heads/wip/drop-containers-dep-from-th
> 
> 
> However, I'm wondering if we really need Data.Map, or if would be
> equally ok to simply use  O(n) Prelude.lookup-style dictionary
> 
> Does anyone here happen to have an estimate for how large the dictionary
> in
> 
>  https://git.haskell.org/ghc.git/blob/HEAD:/libraries/template-haskell/Language/Haskell/TH/PprLib.hs#l120
> 
> (which is the only use of Data.Map in TH) typically gets?
> 
> Cheers,
>  hvr
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list