diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-06-18 00:00:11 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-06-18 00:00:11 +0200 |
commit | d1b2e2c3a3cdaf49ff5e4bae6fe9b0612c3779c2 (patch) | |
tree | 38577e02839ac18244aa46b833da8957cbe9789e /src/CHAD/Types.hs | |
parent | 2b1a40b5933b8b0dceaae744e5b70cb604822c9d (diff) |
Tests pass, should check if output is sensible
Diffstat (limited to 'src/CHAD/Types.hs')
-rw-r--r-- | src/CHAD/Types.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/CHAD/Types.hs b/src/CHAD/Types.hs index 83f013d..8b3a8db 100644 --- a/src/CHAD/Types.hs +++ b/src/CHAD/Types.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module CHAD.Types where @@ -124,3 +125,18 @@ lemZeroInfoScal STI64 = Refl lemZeroInfoScal STF32 = Refl lemZeroInfoScal STF64 = Refl lemZeroInfoScal STBool = Refl + +d1Identity :: STy t -> D1 t :~: t +d1Identity = \case + STNil -> Refl + STPair a b | Refl <- d1Identity a, Refl <- d1Identity b -> Refl + STEither a b | Refl <- d1Identity a, Refl <- d1Identity b -> Refl + STLEither a b | Refl <- d1Identity a, Refl <- d1Identity b -> Refl + STMaybe t | Refl <- d1Identity t -> Refl + STArr _ t | Refl <- d1Identity t -> Refl + STScal _ -> Refl + STAccum{} -> error "Accumulators not allowed in input program" + +d1eIdentity :: SList STy env -> D1E env :~: env +d1eIdentity SNil = Refl +d1eIdentity (t `SCons` env) | Refl <- d1Identity t, Refl <- d1eIdentity env = Refl |