[Haskell] Excessive sharing and GHC
simonpj at microsoft.com
Wed Oct 19 03:43:26 EDT 2005
| > >I was thinking it would be nice if one could put a pragma on CAFs
| > >basically made ghc treat them as WHNF so it would float them inward
| > >far as possible including inside lambdas. in particular, constant
| > >strings that are created (cheaply) from efficient internal
| > >representations should not be held onto in their inefficient form.
I think the way to do this is to explain to GHC that
unpackCString :: String# -> [Char]
is a "cheap" function; that is, applications of it can safely be
duplicated. There's no pragma to do this to an arbitrary at present,
but it'd be a sensible sort of pragma to have.
I wonder if it would make any difference in practice.
More information about the Haskell