Yeah that’s right, if you look at the Core representation then you’ll see something like this:
mystring = "sometext"
Gets compiled into:
mystring = fromCString# "sometext"#
That "sometext"#
is basically a raw bytestring and fromCString#
transforms that into a normal Haskell string. If we add overloadedstrings into the mix you’d get something like:
mystring = Text.pack (fromCString# "sometext"#)
And the text package has this rule:
{-# RULES "TEXT literal" forall a.
pack (GHC.unpackCString# a) = unpackCStringAscii# a #-}
(And there’s another rule for utf8 literals.)
So it rewrites the primitve that generate strings to a primitive that generate Text directly.