JavaScript: Re-add optimisation for literal strings
In GHCJS, the genApp
function contained an optimisation for unpacking string literals:
-- special cases for JSString literals
-- we could handle unpackNBytes# here, but that's probably not common
-- enough to warrant a special case
| [StgVarArg v] <- args
, [top] <- concatMap snd (ctxTarget ctx)
, matchVarName "ghcjs-prim" "GHCJS.Prim" "unsafeUnpackJSStringUtf8##" i =
(,ExprInline Nothing) . (|=) top . app "h$decodeUtf8z" <$> varsForId v
This wasn't ported with the JavaScript backend, but should be added now in GHC.StgToJS.Apply.genApp
.