Skip to content

Commit

Permalink
Add Requirements instances
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCacqueray committed Jul 9, 2022
1 parent 5f829e1 commit 05f91dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/Swarm/Game/Exception.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import Control.Lens ((^.))
import Data.Map qualified as M
import Data.Set qualified as S
import Data.Aeson (FromJSON, ToJSON)
import Data.Set (Set)
import Data.Text (Text)
import Data.Text qualified as T
import Witch (from)
Expand Down
5 changes: 3 additions & 2 deletions src/Swarm/Language/Requirement.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module Swarm.Language.Requirement (
) where

import Data.Bifunctor (first)
import Data.Aeson (FromJSON, ToJSON)
import Data.Data (Data)
import Data.Hashable (Hashable)
import Data.Map (Map)
Expand Down Expand Up @@ -72,7 +73,7 @@ data Requirement
-- of entity `e` and later requiring 7 is the same as requiring
-- 12.
ReqInv Int Text
deriving (Eq, Ord, Show, Read, Generic, Hashable, Data)
deriving (Eq, Ord, Show, Read, Generic, Hashable, Data, FromJSON, ToJSON)

-- | It is tempting to define @Requirements = Set Requirement@, but
-- that would be wrong, since two identical 'ReqInv' should have
Expand All @@ -86,7 +87,7 @@ data Requirements = Requirements
, devReqs :: Set Text
, invReqs :: Map Text Int
}
deriving (Eq, Ord, Show, Data)
deriving (Eq, Ord, Show, Data, Generic, FromJSON, ToJSON)

instance Semigroup Requirements where
Requirements c1 d1 i1 <> Requirements c2 d2 i2 =
Expand Down

0 comments on commit 05f91dd

Please sign in to comment.