diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-11-10 22:40:54 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-11-10 22:40:54 +0100 |
commit | a46f53695d1dfab8834c7cc52707c0c0bb9b8ba0 (patch) | |
tree | 1f00fa82540f4a54ddbf45fc6e5717b6dd8d5f94 /src/Interpreter | |
parent | 4d573fa32997a8e4824bf8326fb675d0c195b1ac (diff) |
Test gmm
Diffstat (limited to 'src/Interpreter')
-rw-r--r-- | src/Interpreter/Rep.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Interpreter/Rep.hs b/src/Interpreter/Rep.hs index 7ef9088..0007991 100644 --- a/src/Interpreter/Rep.hs +++ b/src/Interpreter/Rep.hs @@ -3,7 +3,7 @@ {-# LANGUAGE UndecidableInstances #-} module Interpreter.Rep where -import Data.List (intersperse) +import Data.List (intersperse, intercalate) import Data.Foldable (toList) import Data.IORef import GHC.TypeError @@ -11,6 +11,7 @@ import GHC.TypeError import Array import AST import AST.Pretty +import Data type family Rep t where @@ -76,3 +77,10 @@ showValue _ (STScal sty) x = case sty of STI64 -> shows x STBool -> shows x showValue _ (STAccum t) _ = showString $ "<accumulator for " ++ ppTy 0 t ++ ">" + +showEnv :: SList STy env -> SList Value env -> String +showEnv = \env vals -> "[" ++ intercalate ", " (showEntries env vals) ++ "]" + where + showEntries :: SList STy env -> SList Value env -> [String] + showEntries SNil SNil = [] + showEntries (t `SCons` env) (Value x `SCons` xs) = showValue 0 t x "" : showEntries env xs |