Skip to content

Instantly share code, notes, and snippets.

@TerrorJack
Last active May 10, 2019 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TerrorJack/ea0c11bc01aacf4a81cdaf96a21034a2 to your computer and use it in GitHub Desktop.
Save TerrorJack/ea0c11bc01aacf4a81cdaf96a21034a2 to your computer and use it in GitHub Desktop.
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# OPTIONS_GHC -Wall -O2 -fforce-recomp -ddump-to-file -ddump-simpl -ddump-stg -ddump-cmm-raw -ddump-asm #-}
import GHC.Exts
import GHC.Types
main :: IO ()
main = do
r <-
IO $ \s0 ->
case newByteArray# 8# s0 of
(# s1, mba #) ->
case writeInt8Array# mba 0# 255# s1 of
s2 ->
case unsafeFreezeByteArray# mba s2 of
(# s10, ba #) -> (# s10, I# (indexInt8Array# ba 0#) #)
print r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment