| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Util.DepPair
Synopsis
- data GenDepPair g f where
- GenDepPair :: !(f a) -> !(g a) -> GenDepPair g f
- pattern DepPair :: f a -> a -> DepPair f
- type DepPair = GenDepPair I
- depPairFirst :: (forall a. f a -> f' a) -> GenDepPair g f -> GenDepPair g f'
- class SameDepIndex f where
- sameDepIndex :: f a -> f b -> Maybe (a :~: b)
- class TrivialDependency f where
- type TrivialIndex f :: Type
- hasSingleIndex :: f a -> f b -> a :~: b
- indexIsTrivial :: f (TrivialIndex f)
- fromTrivialDependency :: TrivialDependency f => f a -> a -> TrivialIndex f
- toTrivialDependency :: TrivialDependency f => f a -> TrivialIndex f -> a
- data (a :: k) :~: (b :: k) where
- data Proxy (t :: k) = Proxy
Dependent pairs
data GenDepPair g f where Source #
Generalization of DepPair
This adds an additional functor g around the second value in the pair.
Constructors
| GenDepPair :: !(f a) -> !(g a) -> GenDepPair g f |
Instances
type DepPair = GenDepPair I Source #
Dependent pair
A dependent pair is a pair of values where the type of the value depends on the first value.
depPairFirst :: (forall a. f a -> f' a) -> GenDepPair g f -> GenDepPair g f' Source #
Compare indices
class SameDepIndex f where Source #
Minimal complete definition
Nothing
Methods
sameDepIndex :: f a -> f b -> Maybe (a :~: b) Source #
default sameDepIndex :: TrivialDependency f => f a -> f b -> Maybe (a :~: b) Source #
Instances
Trivial dependency
class TrivialDependency f where Source #
A dependency is trivial if it always maps to the same type b
Associated Types
type TrivialIndex f :: Type Source #
Methods
hasSingleIndex :: f a -> f b -> a :~: b Source #
indexIsTrivial :: f (TrivialIndex f) Source #
Instances
| TrivialDependency (NestedCtxt_ blk f) => TrivialDependency (NestedCtxt f blk) Source # | |
Defined in Ouroboros.Consensus.Block.NestedContent Associated Types type TrivialIndex (NestedCtxt f blk) Source # Methods hasSingleIndex :: NestedCtxt f blk a -> NestedCtxt f blk b -> a :~: b Source # indexIsTrivial :: NestedCtxt f blk (TrivialIndex (NestedCtxt f blk)) Source # | |
fromTrivialDependency :: TrivialDependency f => f a -> a -> TrivialIndex f Source #
toTrivialDependency :: TrivialDependency f => f a -> TrivialIndex f -> a Source #
Convenience re-exports
data (a :: k) :~: (b :: k) where infix 4 #
Propositional equality. If a :~: b is inhabited by some terminating
value, then the type a is the same as the type b. To use this equality
in practice, pattern-match on the a :~: b to get out the Refl constructor;
in the body of the pattern-match, the compiler knows that a ~ b.
Since: base-4.7.0.0
Instances
| TestEquality ((:~:) a :: k -> Type) | Since: base-4.7.0.0 |
Defined in Data.Type.Equality | |
| NFData2 ((:~:) :: Type -> Type -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| NFData1 ((:~:) a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| a ~ b => Bounded (a :~: b) | Since: base-4.7.0.0 |
| a ~ b => Enum (a :~: b) | Since: base-4.7.0.0 |
Defined in Data.Type.Equality Methods succ :: (a :~: b) -> a :~: b # pred :: (a :~: b) -> a :~: b # fromEnum :: (a :~: b) -> Int # enumFrom :: (a :~: b) -> [a :~: b] # enumFromThen :: (a :~: b) -> (a :~: b) -> [a :~: b] # enumFromTo :: (a :~: b) -> (a :~: b) -> [a :~: b] # enumFromThenTo :: (a :~: b) -> (a :~: b) -> (a :~: b) -> [a :~: b] # | |
| Eq (a :~: b) | Since: base-4.7.0.0 |
| Ord (a :~: b) | Since: base-4.7.0.0 |
Defined in Data.Type.Equality | |
| a ~ b => Read (a :~: b) | Since: base-4.7.0.0 |
| Show (a :~: b) | Since: base-4.7.0.0 |
| NFData (a :~: b) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Proxy is a type that holds no data, but has a phantom parameter of
arbitrary type (or even kind). Its use is to provide type information, even
though there is no value available of that type (or it may be too costly to
create one).
Historically, is a safer alternative to the
Proxy :: Proxy a idiom.undefined :: a
>>>Proxy :: Proxy (Void, Int -> Int)Proxy
Proxy can even hold types of higher kinds,
>>>Proxy :: Proxy EitherProxy
>>>Proxy :: Proxy FunctorProxy
>>>Proxy :: Proxy complicatedStructureProxy
Constructors
| Proxy |
Instances
| Generic1 (Proxy :: k -> Type) | Since: base-4.6.0.0 |
| Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
| Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
| Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
| Foldable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldMap' :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
| Traversable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
| MonadPlus (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
| Alternative (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
| Contravariant (Proxy :: Type -> Type) | |
| Eq1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
| Ord1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
| Read1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
| Show1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
| NFData1 (Proxy :: Type -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| Hashable1 (Proxy :: Type -> Type) | |
Defined in Data.Hashable.Class | |
| Bounded (Proxy t) | Since: base-4.7.0.0 |
| Enum (Proxy s) | Since: base-4.7.0.0 |
| Eq (Proxy s) | Since: base-4.7.0.0 |
| Ord (Proxy s) | Since: base-4.7.0.0 |
| Read (Proxy t) | Since: base-4.7.0.0 |
| Show (Proxy s) | Since: base-4.7.0.0 |
| Ix (Proxy s) | Since: base-4.7.0.0 |
Defined in Data.Proxy | |
| Generic (Proxy t) | Since: base-4.6.0.0 |
| Semigroup (Proxy s) | Since: base-4.9.0.0 |
| Monoid (Proxy s) | Since: base-4.7.0.0 |
| NFData (Proxy a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
| Hashable (Proxy a) | |
| Serialise (Proxy a) | Since: serialise-0.2.0.0 |
| type Rep1 (Proxy :: k -> Type) | |
| type Rep (Proxy t) | |