playing with i31
This commit is contained in:
+15
-1
@@ -28,6 +28,10 @@ module Gyehoek.Wasm
|
||||
, result
|
||||
, param
|
||||
, if'
|
||||
, ref
|
||||
, eq
|
||||
, i31ref
|
||||
, i31
|
||||
)
|
||||
where
|
||||
|
||||
@@ -59,6 +63,7 @@ import Language.Sexp.Located
|
||||
import qualified Gyehoek.Sexp
|
||||
import GHC.IsList (IsList(..))
|
||||
import Data.Coerce (coerce)
|
||||
import qualified Control.Category
|
||||
|
||||
|
||||
data Module = MkModule
|
||||
@@ -160,8 +165,14 @@ execGenMod = fmap snd . runGenMod
|
||||
renderModule :: Module -> Text
|
||||
renderModule = (^?! _Right) . Gyehoek.Sexp.encodePretty
|
||||
|
||||
i32 :: Type
|
||||
ref :: Type -> Type
|
||||
ref (MkType x) = MkType . ParenList $ [Symbol "ref", x]
|
||||
|
||||
i32, i31ref, eq, i31 :: Type
|
||||
i32 = MkType $ Symbol "i32"
|
||||
i31ref = MkType $ Symbol "i31ref"
|
||||
eq = MkType $ Symbol "eq"
|
||||
i31 = MkType $ Symbol "i31"
|
||||
|
||||
|
||||
|
||||
@@ -206,6 +217,9 @@ instance SexpIso Module where
|
||||
<> (m ^.. #functions . each . to sxp)
|
||||
<> (m ^.. #exports . each . to sxp)
|
||||
|
||||
instance SexpIso Sexp where
|
||||
sexpIso = Control.Category.id
|
||||
|
||||
instance Each Expr Expr Instr Instr where
|
||||
each = #MkExpr . each
|
||||
|
||||
|
||||
Reference in New Issue
Block a user