Skip to content

Commit 05b7cb1

Browse files
committed
Make Ord SelectView explicit
1 parent d6e5dfd commit 05b7cb1

File tree

1 file changed

+7
-1
lines changed
  • ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Protocol

1 file changed

+7
-1
lines changed

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Protocol/Abstract.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module Ouroboros.Consensus.Protocol.Abstract
2727
) where
2828

2929
import Control.Monad.Except
30+
import Data.Function (on)
3031
import Data.Kind (Type)
3132
import Data.Proxy (Proxy)
3233
import Data.Typeable (Typeable)
@@ -279,7 +280,12 @@ deriving stock instance Eq (TiebreakerView p) => Eq (SelectView p)
279280
instance NoThunks (TiebreakerView p) => NoThunks (SelectView p)
280281

281282
-- | First compare block numbers, then compare the 'TiebreakerView'.
282-
deriving stock instance Ord (TiebreakerView p) => Ord (SelectView p)
283+
instance Ord (TiebreakerView p) => Ord (SelectView p) where
284+
compare =
285+
mconcat
286+
[ compare `on` svBlockNo
287+
, compare `on` svTiebreakerView
288+
]
283289

284290
-- | @cand@ is preferred to @ours@ if either @cand@ is longer than @ours@, or
285291
-- @cand@ and @ours@ are of equal length and we have

0 commit comments

Comments
 (0)