1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 12:21:57 +03:00

Merge branch 'master' into change-port

This commit is contained in:
Rob Rix 2018-08-15 09:33:23 -04:00 committed by GitHub
commit 4d29fc87f3
2 changed files with 6 additions and 2 deletions

View File

@ -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.

View File

@ -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