Hey all,

Can GHC eliminate one of two equal ByteStrings, when they are compared
and turns out to be equal?


Say i have a map, ByteString -> Int.

I now do a lookup on a ByteString and if it exists, I insert this
ByteString into a list.

Is it possible to avoid using more memory, than used by the keys in
the map + the list structure?

I.e. is it possible to eliminate the redundant ByteStrings somehow?

I guess, this could be done by having lookup return the key as well,
and then insert this key into the list, however, that's a bit ugly and
somewhat anti-intuitive.


Here's an example program, to illustrate the idea:
https://gist.github.com/1472418

-- 
Johan Brinch

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

Reply via email to