From a46f53695d1dfab8834c7cc52707c0c0bb9b8ba0 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 10 Nov 2024 22:40:54 +0100 Subject: Test gmm --- src/Interpreter/Rep.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Interpreter') 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 $ "" + +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 -- cgit v1.2.3-70-g09d2