diff --git a/src/Data/Abstract/Environment.hs b/src/Data/Abstract/Environment.hs index 91f222e62..6d6e018a1 100644 --- a/src/Data/Abstract/Environment.hs +++ b/src/Data/Abstract/Environment.hs @@ -37,7 +37,7 @@ import Prologue -- | A map of names to values. Represents a single scope level of an environment chain. newtype Bindings address = Bindings { unBindings :: Map.Map Name address } - deriving (Eq, Ord, Show) + deriving (Eq, Ord) instance Semigroup (Bindings address) where (<>) (Bindings a) (Bindings b) = Bindings (a <> b) @@ -49,6 +49,10 @@ instance Monoid (Bindings address) where instance Lower (Bindings address) where lowerBound = mempty +instance Show address => Show (Bindings address) where + showsPrec d = showsUnaryWith showsPrec "Bindings" d . pairs + + -- | A LIFO stack of maps of names to addresses, representing a lexically-scoped evaluation environment. -- All behaviors can be assumed to be frontmost-biased: looking up "a" will check the most specific -- scope for "a", then the next, and so on. diff --git a/src/Data/Abstract/Heap.hs b/src/Data/Abstract/Heap.hs index 740046f55..32d38ac96 100644 --- a/src/Data/Abstract/Heap.hs +++ b/src/Data/Abstract/Heap.hs @@ -52,4 +52,4 @@ instance (Ord address, Ord value) => Reducer (address, value) (Heap address valu snoc (Heap heap) (addr, a) = Heap (snoc heap (addr, a)) instance (Show address, Show value) => Show (Heap address value) where - showsPrec d = showsUnaryWith showsPrec "Heap" d . Monoidal.pairs . unHeap + showsPrec d = showsUnaryWith showsPrec "Heap" d . map (second toList) . Monoidal.pairs . unHeap