diff options
author | Tom Smeding <tom@tomsmeding.com> | 2023-09-16 18:03:44 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2023-09-16 18:03:44 +0200 |
commit | 7095bcf4910e2b1525234ca8e88f4effc25315bd (patch) | |
tree | 50ca15ca9d774c739b7320e4b68ef2b600e52ab1 /src/Example.hs | |
parent | 35cc10682f35dafba98000bf35191896a6432624 (diff) |
Pretty print
Diffstat (limited to 'src/Example.hs')
-rw-r--r-- | src/Example.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Example.hs b/src/Example.hs index 89b2082..99574c5 100644 --- a/src/Example.hs +++ b/src/Example.hs @@ -2,13 +2,43 @@ module Example where import AST +import AST.Pretty import CHAD bin :: SOp (TPair a b) c -> Ex env a -> Ex env b -> Ex env c bin op a b = EOp ext op (EPair ext a b) +senv1 :: SList STy [TScal TF32, TScal TF32] +senv1 = STScal STF32 `SCons` STScal STF32 `SCons` SNil + -- x y |- x * y + x +-- +-- let x3 = (x1, x2) +-- x4 = ((*) x3, x1) +-- in ( (+) x4 +-- , let x5 = 1.0 +-- x6 = inr (x5, x5) +-- in case x6 of +-- Inl x7 -> return () +-- Inr x8 -> +-- let x9 = fst x8 +-- x10 = inr (snd x3 * x9, fst x3 * x9) +-- in case x10 of +-- Inl x11 -> return () +-- Inr x12 -> +-- let x13 = fst x12 +-- in one "v1" x13 >>= \x14 -> +-- let x15 = snd x12 +-- in one "v2" x15 >>= \x16 -> +-- let x17 = snd x8 +-- in one "v1" x17) +-- +-- ( (x1 * x2) + x1 +-- , let x5 = 1.0 +-- in do one "v1" (x2 * x5) +-- one "v2" (x1 * x5) +-- one "v1" x5) ex1 :: Ex [TScal TF32, TScal TF32] (TScal TF32) ex1 = bin (OAdd STF32) |