From 05f91dd0d3334224d524464683aa81f19cbca726 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Sat, 9 Jul 2022 20:58:34 +0000 Subject: [PATCH] Add Requirements instances --- src/Swarm/Game/Exception.hs | 1 - src/Swarm/Language/Requirement.hs | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Swarm/Game/Exception.hs b/src/Swarm/Game/Exception.hs index 07a03635b..c1b1db4b4 100644 --- a/src/Swarm/Game/Exception.hs +++ b/src/Swarm/Game/Exception.hs @@ -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) diff --git a/src/Swarm/Language/Requirement.hs b/src/Swarm/Language/Requirement.hs index 6426a5326..da61eb819 100644 --- a/src/Swarm/Language/Requirement.hs +++ b/src/Swarm/Language/Requirement.hs @@ -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) @@ -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 @@ -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 =