Skip to content

Commit

Permalink
Use network's Some and make SomeSecond poly-kinded
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Apr 16, 2024
1 parent a524414 commit ff8df67
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -12,6 +12,7 @@
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE UndecidableInstances #-}

-- | Miscellaneous utilities
Expand Down Expand Up @@ -102,6 +103,7 @@ import Data.Word (Word64)
import GHC.Generics (Generic)
import GHC.Stack
import Ouroboros.Consensus.Util.IOLike
import Ouroboros.Network.Protocol.LocalStateQuery.Codec (Some (..))
import Ouroboros.Network.Util.ShowProxy (ShowProxy (..))

{-------------------------------------------------------------------------------
Expand All @@ -111,9 +113,6 @@ import Ouroboros.Network.Util.ShowProxy (ShowProxy (..))
class Empty a
instance Empty a

data Some (f :: k -> Type) where
Some :: f a -> Some f

-- | Pair of functors instantiated to the /same/ existential
data SomePair (f :: k -> Type) (g :: k -> Type) where
SomePair :: f a -> g a -> SomePair f g
Expand All @@ -122,7 +121,8 @@ data SomePair (f :: k -> Type) (g :: k -> Type) where
--
-- @SomeSecond f a@ is isomorphic to @Some (f a)@, but is more convenient in
-- partial applications.
data SomeSecond (f :: Type -> Type -> Type) a where
type SomeSecond :: (k1 -> k2 -> Type) -> k1 -> Type
data SomeSecond f a where
SomeSecond :: !(f a b) -> SomeSecond f a

mustBeRight :: Either Void a -> a
Expand Down Expand Up @@ -368,6 +368,7 @@ allDisjoint = go Set.empty

(......:) :: (y -> z) -> (x0 -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> y) -> (x0 -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> z)
(f ......: g) x0 x1 x2 x3 x4 x5 x6 = f (g x0 x1 x2 x3 x4 x5 x6)

{-------------------------------------------------------------------------------
Product
-------------------------------------------------------------------------------}
Expand Down

0 comments on commit ff8df67

Please sign in to comment.