ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.HardFork.Combinator.Util.Match

Description

Intended for qualified import

import Ouroboros.Consensus.HardFork.Combinator.Util.Match (Mismatch(..))
import qualified Ouroboros.Consensus.HardFork.Combinator.Util.Match as Match
Synopsis

Documentation

data Mismatch ∷ (k → Type) → (k → Type) → [k] → Type where Source #

Constructors

ML ∷ f x → NS g xs → Mismatch f g (x ': xs) 
MRNS f xs → g x → Mismatch f g (x ': xs) 
MSMismatch f g xs → Mismatch f g (x ': xs) 

Instances

Instances details
HAp (Mismatch f ∷ (k → Type) → [k] → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

Methods

hap ∷ ∀ (f0 ∷ k0 → Type) (g ∷ k0 → Type) (xs ∷ l). Prod (Mismatch f) (f0 -.-> g) xs → Mismatch f f0 xs → Mismatch f g xs #

(All (Compose Eq f) xs, All (Compose Eq g) xs) ⇒ Eq (Mismatch f g xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

Methods

(==)Mismatch f g xs → Mismatch f g xs → Bool Source #

(/=)Mismatch f g xs → Mismatch f g xs → Bool 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 # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

Methods

compareMismatch f g xs → Mismatch f g xs → Ordering Source #

(<)Mismatch f g xs → Mismatch f g xs → Bool Source #

(<=)Mismatch f g xs → Mismatch f g xs → Bool Source #

(>)Mismatch f g xs → Mismatch f g xs → Bool Source #

(>=)Mismatch f g xs → Mismatch f g xs → Bool Source #

maxMismatch f g xs → Mismatch f g xs → Mismatch f g xs Source #

minMismatch f g xs → Mismatch f g xs → Mismatch f g xs Source #

(All (Compose Show f) xs, All (Compose Show g) xs) ⇒ Show (Mismatch f g xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

Methods

showsPrecIntMismatch f g xs → ShowS Source #

showMismatch f g xs → String Source #

showList ∷ [Mismatch f g xs] → ShowS Source #

(All (Compose NoThunks f) xs, All (Compose NoThunks g) xs) ⇒ NoThunks (Mismatch f g xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

Methods

noThunks ∷ Context → Mismatch f g xs → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → Mismatch f g xs → IO (Maybe ThunkInfo) #

showTypeOfProxy (Mismatch f g xs) → String #

type Prod (Mismatch f ∷ (k → Type) → [k] → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

type Prod (Mismatch f ∷ (k → Type) → [k] → Type) = NP ∷ (k → Type) → [k] → Type
type SListIN (Mismatch f ∷ (k → Type) → [k] → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

type SListIN (Mismatch f ∷ (k → Type) → [k] → Type) = SListI ∷ [k] → Constraint
type AllN (Mismatch f ∷ (k → Type) → [k] → Type) (c ∷ k → Constraint) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Util.Match

type AllN (Mismatch f ∷ (k → Type) → [k] → Type) (c ∷ k → Constraint) = All c

flipMismatch f g xs → Mismatch g f xs Source #

matchNSNS f xs → NS g xs → Either (Mismatch f g xs) (NS (Product f g) xs) Source #

matchTelescopeNS h xs → Telescope g f xs → Either (Mismatch h f xs) (Telescope g (Product h f) xs) Source #

Utilities

mismatchNotEmptyMismatch f g xs → (∀ x xs'. xs ~ (x ': xs') ⇒ Mismatch f g (x ': xs') → a) → a Source #

mismatchNotFirstMismatch f g (x ': xs) → Either (NS f xs) (NS g xs) Source #

mismatchOneMismatch f g '[x] → Void Source #

We cannot give a mismatch if we have only one type variable

mismatchToNSMismatch f g xs → (NS f xs, NS g xs) Source #

Project two NS from a Mismatch

We should have the property that

uncurry matchNS (mismatchToNS m) == Left m

mismatchTwoMismatch 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

mkMismatchTwoEither (f x, g y) (f y, g x) → Mismatch f g '[x, y] Source #

mustMatchNS ∷ ∀ f g xs. HasCallStackStringNS f xs → NS g xs → NS (Product f g) xs Source #

Variant of matchNS for when we know the two NSs must match. Otherwise an error, mentioning the given String, is thrown.

SOP operators

bihapNP (f -.-> f') xs → NP (g -.-> g') xs → Mismatch f g xs → Mismatch f' g' xs Source #

bihcmapAll c xs ⇒ proxy c → (∀ x. c x ⇒ f x → f' x) → (∀ x. c x ⇒ g x → g' x) → Mismatch f g xs → Mismatch f' g' xs Source #

Bifunctor analogue of hcmap

bihmapSListI xs ⇒ (∀ x. f x → f' x) → (∀ x. g x → g' x) → Mismatch f g xs → Mismatch f' g' xs Source #