4 ms·
import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as C main = do let x = 100 print (x * x) let y:_ = B.unp
by owl57 7y ago
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C
main = do
let x = 100
print (x * x)
let y:_ = B.unpack (C.pack "foo")
--let z = x * y
return ()
If we uncomment that line, the output of this program changes from 10000 to 16. Yes, I learned this by triggering similar action "in the past" accidentally. Don't remember details, but that program also involved ByteStrings. The convention of explicitly type-annotating top-level declarations is there for a reason: it limits the scope of damage.