mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
🔥 the Generic1 instance for Environment.
This commit is contained in:
parent
016838cb81
commit
5f0ed448ae
@ -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
|
||||
-- scope for "a", then the next, and so on.
|
||||
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 Ord location => Ord1 (Environment location) where liftCompare = genericLiftCompare
|
||||
instance Show location => Show1 (Environment location) where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Eq location => Eq1 (Environment location) where liftEq _ a b = unEnvironment a == unEnvironment b
|
||||
instance Ord location => Ord1 (Environment location) where liftCompare _ a b = unEnvironment a `compare` unEnvironment b
|
||||
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
|
||||
-- (despite NonEmpty's instance being partial). Don't pass in multiple Addresses for the
|
||||
|
Loading…
Reference in New Issue
Block a user