1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Revert "Revert "🔥 the Generic1 instance for Environment.""

This reverts commit ce88512116f1f55ad15433471a13a112cfc322c4.
This commit is contained in:
Rob Rix 2018-05-11 08:52:22 -04:00
parent e18827f03f
commit 5cfa7028e7

View File

@ -38,11 +38,11 @@ import qualified Data.List.NonEmpty as NonEmpty
-- All behaviors can be assumed to be frontmost-biased: looking up "a" will check the most specific -- 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. -- scope for "a", then the next, and so on.
newtype Environment location value = Environment { unEnvironment :: NonEmpty (Map.Map Name location) } newtype Environment location value = Environment { unEnvironment :: NonEmpty (Map.Map Name location) }
deriving (Eq, Generic1, Ord, Show) deriving (Eq, Ord, Show)
instance Eq location => Eq1 (Environment location) where liftEq = genericLiftEq instance Eq location => Eq1 (Environment location) where liftEq _ a b = unEnvironment a == unEnvironment b
instance Ord location => Ord1 (Environment location) where liftCompare = genericLiftCompare instance Ord location => Ord1 (Environment location) where liftCompare _ a b = unEnvironment a `compare` unEnvironment b
instance Show location => Show1 (Environment location) where liftShowsPrec = genericLiftShowsPrec instance Show location => Show1 (Environment location) where liftShowsPrec _ _ = showsPrec
-- | The provided list will be put into an Environment with one member, so fromList is total -- | The provided list will be put into an Environment with one member, so fromList is total
-- (despite NonEmpty's instance being partial). Don't pass in multiple Addresses for the -- (despite NonEmpty's instance being partial). Don't pass in multiple Addresses for the