{-# OPTIONS_GHC -Wno-orphans #-} module Ouroboros.Consensus.HardFork.Combinator.Ledger.PeerSelection () where import Data.SOP.BasicFunctors import Data.SOP.Strict import Ouroboros.Consensus.HardFork.Combinator.Abstract import Ouroboros.Consensus.HardFork.Combinator.Basics import Ouroboros.Consensus.HardFork.Combinator.Ledger () import qualified Ouroboros.Consensus.HardFork.Combinator.State as State import Ouroboros.Consensus.Ledger.SupportsPeerSelection instance CanHardFork xs => LedgerSupportsPeerSelection (HardForkBlock xs) where getPeers :: LedgerState (HardForkBlock xs) -> [(PoolStake, NonEmpty StakePoolRelay)] getPeers = NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs -> [(PoolStake, NonEmpty StakePoolRelay)] NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs -> CollapseTo NS [(PoolStake, NonEmpty StakePoolRelay)] forall (xs :: [*]) a. SListIN NS xs => NS (K a) xs -> CollapseTo NS a forall k l (h :: (k -> *) -> l -> *) (xs :: l) a. (HCollapse h, SListIN h xs) => h (K a) xs -> CollapseTo h a hcollapse (NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs -> [(PoolStake, NonEmpty StakePoolRelay)]) -> (LedgerState (HardForkBlock xs) -> NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs) -> LedgerState (HardForkBlock xs) -> [(PoolStake, NonEmpty StakePoolRelay)] forall b c a. (b -> c) -> (a -> b) -> a -> c . Proxy SingleEraBlock -> (forall a. SingleEraBlock a => LedgerState a -> K [(PoolStake, NonEmpty StakePoolRelay)] a) -> NS LedgerState xs -> NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint) (xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *). (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs hcmap Proxy SingleEraBlock proxySingle ([(PoolStake, NonEmpty StakePoolRelay)] -> K [(PoolStake, NonEmpty StakePoolRelay)] a forall k a (b :: k). a -> K a b K ([(PoolStake, NonEmpty StakePoolRelay)] -> K [(PoolStake, NonEmpty StakePoolRelay)] a) -> (LedgerState a -> [(PoolStake, NonEmpty StakePoolRelay)]) -> LedgerState a -> K [(PoolStake, NonEmpty StakePoolRelay)] a forall b c a. (b -> c) -> (a -> b) -> a -> c . LedgerState a -> [(PoolStake, NonEmpty StakePoolRelay)] forall blk. LedgerSupportsPeerSelection blk => LedgerState blk -> [(PoolStake, NonEmpty StakePoolRelay)] getPeers) (NS LedgerState xs -> NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs) -> (LedgerState (HardForkBlock xs) -> NS LedgerState xs) -> LedgerState (HardForkBlock xs) -> NS (K [(PoolStake, NonEmpty StakePoolRelay)]) xs forall b c a. (b -> c) -> (a -> b) -> a -> c . HardForkState LedgerState xs -> NS LedgerState xs forall (xs :: [*]) (f :: * -> *). SListI xs => HardForkState f xs -> NS f xs State.tip (HardForkState LedgerState xs -> NS LedgerState xs) -> (LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs) -> LedgerState (HardForkBlock xs) -> NS LedgerState xs forall b c a. (b -> c) -> (a -> b) -> a -> c . LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs forall (xs :: [*]). LedgerState (HardForkBlock xs) -> HardForkState LedgerState xs hardForkLedgerStatePerEra