summaryrefslogtreecommitdiff
path: root/src/CHAD/Types.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-04-29 20:37:06 +0200
committerTom Smeding <tom@tomsmeding.com>2025-04-29 20:38:05 +0200
commitd0eb9a1edfb4233d557d954f46685f25382234d8 (patch)
tree04eb5a746258fcaa2a3b98228c6eadb2b0178ba3 /src/CHAD/Types.hs
parent4ad7eaba73d5fda8ff5028d1e53966f728d704d3 (diff)
Reorder TLEither to after TEither
Diffstat (limited to 'src/CHAD/Types.hs')
-rw-r--r--src/CHAD/Types.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/CHAD/Types.hs b/src/CHAD/Types.hs
index 74e7dbd..974669d 100644
--- a/src/CHAD/Types.hs
+++ b/src/CHAD/Types.hs
@@ -11,19 +11,19 @@ type family D1 t where
D1 TNil = TNil
D1 (TPair a b) = TPair (D1 a) (D1 b)
D1 (TEither a b) = TEither (D1 a) (D1 b)
+ D1 (TLEither a b) = TLEither (D1 a) (D1 b)
D1 (TMaybe a) = TMaybe (D1 a)
D1 (TArr n t) = TArr n (D1 t)
D1 (TScal t) = TScal t
- D1 (TLEither a b) = TLEither (D1 a) (D1 b)
type family D2 t where
D2 TNil = TNil
D2 (TPair a b) = TMaybe (TPair (D2 a) (D2 b))
D2 (TEither a b) = TLEither (D2 a) (D2 b)
+ D2 (TLEither a b) = TLEither (D2 a) (D2 b)
D2 (TMaybe t) = TMaybe (D2 t)
D2 (TArr n t) = TMaybe (TArr n (D2 t))
D2 (TScal t) = D2s t
- D2 (TLEither a b) = TLEither (D2 a) (D2 b)
type family D2s t where
D2s TI32 = TNil
@@ -48,11 +48,11 @@ d1 :: STy t -> STy (D1 t)
d1 STNil = STNil
d1 (STPair a b) = STPair (d1 a) (d1 b)
d1 (STEither a b) = STEither (d1 a) (d1 b)
+d1 (STLEither a b) = STLEither (d1 a) (d1 b)
d1 (STMaybe t) = STMaybe (d1 t)
d1 (STArr n t) = STArr n (d1 t)
d1 (STScal t) = STScal t
d1 STAccum{} = error "Accumulators not allowed in input program"
-d1 (STLEither a b) = STLEither (d1 a) (d1 b)
d1e :: SList STy env -> SList STy (D1E env)
d1e SNil = SNil
@@ -62,6 +62,7 @@ d2M :: STy t -> SMTy (D2 t)
d2M STNil = SMTNil
d2M (STPair a b) = SMTMaybe (SMTPair (d2M a) (d2M b))
d2M (STEither a b) = SMTLEither (d2M a) (d2M b)
+d2M (STLEither a b) = SMTLEither (d2M a) (d2M b)
d2M (STMaybe t) = SMTMaybe (d2M t)
d2M (STArr n t) = SMTMaybe (SMTArr n (d2M t))
d2M (STScal t) = case t of
@@ -71,7 +72,6 @@ d2M (STScal t) = case t of
STF64 -> SMTScal STF64
STBool -> SMTNil
d2M STAccum{} = error "Accumulators not allowed in input program"
-d2M (STLEither a b) = SMTLEither (d2M a) (d2M b)
d2 :: STy t -> STy (D2 t)
d2 = fromSMTy . d2M