From 749df3069669787d2c0a57fb9b9ad66a3605da19 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 4 Dec 2023 11:55:55 -0600 Subject: implement Combinable for Proposal --- src/World/Types.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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') -- cgit v1.2.1