summaryrefslogtreecommitdiff
path: root/src/AST.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-02-25 23:56:16 +0100
committerTom Smeding <tom@tomsmeding.com>2025-02-25 23:56:16 +0100
commit7fa10a9a07c7160531baf595d1111277c17a38b2 (patch)
tree24b7263da33490d954b063926d509e1a10193687 /src/AST.hs
parent2c2b80264ae5777f0a759abb5571cbe68071c7e7 (diff)
Compile: Emit structs in proper order
Diffstat (limited to 'src/AST.hs')
-rw-r--r--src/AST.hs30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/AST.hs b/src/AST.hs
index 99c0681..e22d11f 100644
--- a/src/AST.hs
+++ b/src/AST.hs
@@ -292,23 +292,19 @@ extOf = \case
EOneHot x _ _ _ _ -> x
EError x _ _ -> x
--- unSNat :: SNat n -> Nat
--- unSNat SZ = Z
--- unSNat (SS n) = S (unSNat n)
-
--- unSTy :: STy t -> Ty
--- unSTy = \case
--- STNil -> TNil
--- STPair a b -> TPair (unSTy a) (unSTy b)
--- STEither a b -> TEither (unSTy a) (unSTy b)
--- STMaybe t -> TMaybe (unSTy t)
--- STArr n t -> TArr (unSNat n) (unSTy t)
--- STScal t -> TScal (unSScalTy t)
--- STAccum t -> TAccum (unSTy t)
-
--- unSEnv :: SList STy env -> [Ty]
--- unSEnv SNil = []
--- unSEnv (SCons t l) = unSTy t : unSEnv l
+unSTy :: STy t -> Ty
+unSTy = \case
+ STNil -> TNil
+ STPair a b -> TPair (unSTy a) (unSTy b)
+ STEither a b -> TEither (unSTy a) (unSTy b)
+ STMaybe t -> TMaybe (unSTy t)
+ STArr n t -> TArr (unSNat n) (unSTy t)
+ STScal t -> TScal (unSScalTy t)
+ STAccum t -> TAccum (unSTy t)
+
+unSEnv :: SList STy env -> [Ty]
+unSEnv SNil = []
+unSEnv (SCons t l) = unSTy t : unSEnv l
unSScalTy :: SScalTy t -> ScalTy
unSScalTy = \case