Created
May 22, 2019 17:15
-
-
Save chrisdone/067384de160dbb3cae89a09e2efe4a0d to your computer and use it in GitHub Desktop.
Prana primops demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MagicHash, UnboxedTuples #-} | |
-- | Test some of the ops for Array# and MutableArray#. | |
module ArrayTest where | |
import GHC.Exts | |
import GHC.Types (IO(..)) | |
it :: IO (Char, Int, Char) | |
it = | |
IO | |
(\s -> | |
case newArray# 22# 'a' s of | |
(# s', array #) -> | |
case readArray# array 0# s' of | |
(# s'', ch #) -> | |
case unsafeFreezeArray# array s'' of | |
(# s''', arr #) -> | |
(# s''' | |
, ( ch | |
, I# (sizeofMutableArray# array) | |
, case indexArray# arr 1# of | |
(# x #) -> x)#)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ BeginConStep (UnboxedTupleConId 1) | |
, BeginConStep | |
(DataConId | |
(TypeId {typeIdInt = 117}) | |
(ConIndex {conIndexInt = 0})) | |
, BeginConStep | |
(DataConId | |
(TypeId {typeIdInt = 21}) | |
(ConIndex {conIndexInt = 0})) | |
, LitStep (CharLit 'a') | |
, EndConStep | |
, BeginConStep | |
(DataConId | |
(TypeId {typeIdInt = 20}) | |
(ConIndex {conIndexInt = 0})) | |
, LitStep (IntLit 22) | |
, EndConStep | |
, BeginConStep | |
(DataConId | |
(TypeId {typeIdInt = 21}) | |
(ConIndex {conIndexInt = 0})) | |
, LitStep (CharLit 'a') | |
, EndConStep | |
, EndConStep | |
, EndConStep | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment