| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.HardFork.Combinator.Util.Match
Contents
Description
Intended for qualified import
import Ouroboros.Consensus.HardFork.Combinator.Util.Match (Mismatch(..)) import qualified Ouroboros.Consensus.HardFork.Combinator.Util.Match as Match
Synopsis
- data Mismatch :: (k -> Type) -> (k -> Type) -> [k] -> Type where
- matchNS :: NS f xs -> NS g xs -> Either (Mismatch f g xs) (NS (Product f g) xs)
- matchTelescope :: NS h xs -> Telescope g f xs -> Either (Mismatch h f xs) (Telescope g (Product h f) xs)
- flip :: Mismatch f g xs -> Mismatch g f xs
- mismatchToNS :: Mismatch f g xs -> (NS f xs, NS g xs)
- mismatchOne :: Mismatch f g '[x] -> Void
- mismatchTwo :: Mismatch f g '[x, y] -> Either (f x, g y) (f y, g x)
- mkMismatchTwo :: Either (f x, g y) (f y, g x) -> Mismatch f g '[x, y]
- mismatchNotEmpty :: Mismatch f g xs -> (forall x xs'. xs ~ (x ': xs') => Mismatch f g (x ': xs') -> a) -> a
- mismatchNotFirst :: Mismatch f g (x ': xs) -> Either (NS f xs) (NS g xs)
- mustMatchNS :: forall f g xs. HasCallStack => String -> NS f xs -> NS g xs -> NS (Product f g) xs
- bihap :: NP (f -.-> f') xs -> NP (g -.-> g') xs -> Mismatch f g xs -> Mismatch f' g' xs
- bihmap :: SListI xs => (forall x. f x -> f' x) -> (forall x. g x -> g' x) -> Mismatch f g xs -> Mismatch f' g' xs
- bihcmap :: All c xs => proxy c -> (forall x. c x => f x -> f' x) -> (forall x. c x => g x -> g' x) -> Mismatch f g xs -> Mismatch f' g' xs
Documentation
data Mismatch :: (k -> Type) -> (k -> Type) -> [k] -> Type where Source #
Constructors
| ML :: f x -> NS g xs -> Mismatch f g (x ': xs) | |
| MR :: NS f xs -> g x -> Mismatch f g (x ': xs) | |
| MS :: Mismatch f g xs -> Mismatch f g (x ': xs) |
Instances
| (All (Compose Eq f) xs, All (Compose Eq g) xs) => Eq (Mismatch f g xs) Source # | |
| (All (Compose Eq f) xs, All (Compose Ord f) xs, All (Compose Eq g) xs, All (Compose Ord g) xs) => Ord (Mismatch f g xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match Methods compare :: Mismatch f g xs -> Mismatch f g xs -> Ordering # (<) :: Mismatch f g xs -> Mismatch f g xs -> Bool # (<=) :: Mismatch f g xs -> Mismatch f g xs -> Bool # (>) :: Mismatch f g xs -> Mismatch f g xs -> Bool # (>=) :: Mismatch f g xs -> Mismatch f g xs -> Bool # max :: Mismatch f g xs -> Mismatch f g xs -> Mismatch f g xs # min :: Mismatch f g xs -> Mismatch f g xs -> Mismatch f g xs # | |
| (All (Compose Show f) xs, All (Compose Show g) xs) => Show (Mismatch f g xs) Source # | |
| (All (Compose NoThunks f) xs, All (Compose NoThunks g) xs) => NoThunks (Mismatch f g xs) Source # | |
matchTelescope :: NS h xs -> Telescope g f xs -> Either (Mismatch h f xs) (Telescope g (Product h f) xs) Source #
Utilities
mismatchOne :: Mismatch f g '[x] -> Void Source #
We cannot give a mismatch if we have only one type variable
mismatchTwo :: Mismatch f g '[x, y] -> Either (f x, g y) (f y, g x) Source #
If we only have two eras, only two possibilities for a mismatch
mkMismatchTwo :: Either (f x, g y) (f y, g x) -> Mismatch f g '[x, y] Source #
mismatchNotEmpty :: Mismatch f g xs -> (forall x xs'. xs ~ (x ': xs') => Mismatch f g (x ': xs') -> a) -> a Source #
mustMatchNS :: forall f g xs. HasCallStack => String -> NS f xs -> NS g xs -> NS (Product f g) xs Source #