summaryrefslogtreecommitdiff
path: root/src/Interpreter/Rep.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Interpreter/Rep.hs')
-rw-r--r--src/Interpreter/Rep.hs10
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