summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-12-04 11:55:55 -0600
committersanine <sanine.not@pm.me>2023-12-04 11:55:55 -0600
commit749df3069669787d2c0a57fb9b9ad66a3605da19 (patch)
treee703670de4b88f6f5ef96d9621a6e151de58da32
parent1a3814b5ead29e1bbfb2ccfa56b2b2bb76c71994 (diff)
implement Combinable for Proposal
-rw-r--r--src/World/Types.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/World/Types.hs b/src/World/Types.hs
index cf66dd9..e9be991 100644
--- a/src/World/Types.hs
+++ b/src/World/Types.hs
@@ -101,4 +101,9 @@ instance (Combinable a) => Combinable (AgentPropList a) where
combine (AgentPropList xs) (AgentPropList ys) = AgentPropList $ xs ++ ys
-newtype Proposal a b c = Proposal ([LatticeProposal a b], [AgentProposal c]) deriving (Show, Eq)
+newtype Proposal a b c = Proposal (LatticePropList a b, AgentPropList c) deriving (Show, Eq)
+
+instance (Combinable a, Combinable b, Combinable c) => Combinable (Proposal a b c) where
+ identity = Proposal ([], [])
+ combinable (Proposal (l, a)) (Proposal (l', a')) = (combinable l l') && (combinable a a')
+ combine (Proposal (l, a)) (Proposal (l', a')) = Proposal (combine l l', combine a a')