Skip to content

Commit

Permalink
mention that Semigroup EntityMap instance is right-biased
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Dec 28, 2024
1 parent fcd64ba commit 4d5002c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/swarm-scenario/Swarm/Game/Entity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,15 @@ data EntityMap = EntityMap
}
deriving (Eq, Show, Generic, ToJSON)

-- |
-- Note that duplicates in a single 'EntityMap' are precluded by the
-- 'buildEntityMap' function.
-- But it is possible for the latter 'EntityMap' to override
-- members of the former with the same name.
-- This replacement happens automatically with 'Map', but needs
-- to be explicitly handled for the list concatenation
-- of 'entityDefinitionOrder' (overridden entries are removed
-- from the former 'EntityMap').
-- | Right-biased union of 'EntityMap's.
--
-- Note that duplicates in a single 'EntityMap' are precluded by the
-- 'buildEntityMap' function. But it is possible for the right-hand
-- 'EntityMap' to override members of the left-hand with the same name.
-- This replacement happens automatically with 'Map', but needs to
-- be explicitly handled for the list concatenation of
-- 'entityDefinitionOrder' (overridden entries are removed from the
-- former 'EntityMap').
instance Semigroup EntityMap where
EntityMap n1 c1 d1 <> EntityMap n2 c2 d2 =
EntityMap
Expand Down

0 comments on commit 4d5002c

Please sign in to comment.