Hoogle Search
Within LTS Haskell 24.40 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
validationIsValid :: Validation -> Boolvalidity Data.Validity Check if a Validation concerns a valid value.
void :: Functor f => f a -> f ()utility-ht Control.Functor.HT No documentation available.
void :: Monad m => m a -> m ()utility-ht Control.Monad.HT No documentation available.
biduplicate :: forall (p :: k -> k1 -> Type) . BifunctorComonad t => t p :-> t (t p)bifunctors Data.Bifunctor.Functor No documentation available.
class Divisible f =>
Decidable (f :: Type -> Type)contravariant Data.Functor.Contravariant.Divisible A Decidable contravariant functor is the contravariant analogue of Alternative. Noting the superclass constraint that f must also be Divisible, a Decidable functor has the ability to "fan out" input, under the intuition that contravariant functors consume input. In the discussion for Divisible, an example was demonstrated with Serializers, that turn as into ByteStrings. Divisible allowed us to serialize the product of multiple values by concatenation. By making our Serializer also Decidable- we now have the ability to serialize the sum of multiple values - for example different constructors in an ADT. Consider serializing arbitrary identifiers that can be either Strings or Ints:
data Identifier = StringId String | IntId Int
We know we have serializers for Strings and Ints, but how do we combine them into a Serializer for Identifier? Essentially, our Serializer needs to scrutinise the incoming value and choose how to serialize it:identifier :: Serializer Identifier identifier = Serializer $ \identifier -> case identifier of StringId s -> runSerializer string s IntId i -> runSerializer int i
It is exactly this notion of choice that Decidable encodes. Hence if we add an instance of Decidable for Serializer...instance Decidable Serializer where lose f = Serializer $ \a -> absurd (f a) choose split l r = Serializer $ \a -> either (runSerializer l) (runSerializer r) (split a)
Then our identifier Serializer isidentifier :: Serializer Identifier identifier = choose toEither string int where toEither (StringId s) = Left s toEither (IntId i) = Right i
divide :: Divisible f => (a -> (b, c)) -> f b -> f c -> f acontravariant Data.Functor.Contravariant.Divisible No documentation available.
divided :: Divisible f => f a -> f b -> f (a, b)contravariant Data.Functor.Contravariant.Divisible divided = divide id
class (Generic a, G
Deciding q Rep' a) => Deciding (q :: Type -> Constraint) acontravariant Data.Functor.Contravariant.Generic This provides machinery for deconstructing an arbitrary Generic instance using a Decidable Contravariant functor. Examples:
gcompare :: Deciding Ord a => a -> a -> Ordering gcompare = getComparison $ deciding (Proxy :: Proxy Ord) (Comparison compare)
geq :: Deciding Eq a => a -> a -> Bool geq = getEquivalence $ deciding (Proxy :: Proxy Eq) (Equivalence (==))
class (Generic1 t, G
Deciding1 q Rep1' t) => Deciding1 (q :: Type -> Constraint) (t :: Type -> Type)contravariant Data.Functor.Contravariant.Generic This provides machinery for deconstructing an arbitrary Generic1 instance using a Decidable Contravariant functor. Examples:
gcompare1 :: Deciding1 Ord f => (a -> a -> Ordering) -> f a -> f a -> Ordering gcompare1 f = getComparison $ deciding1 (Proxy :: Proxy Ord) (Comparison compare) (Comparison f)
geq1 :: Deciding1 Eq f => (a -> a -> Bool) -> f a -> f a -> Bool geq1 f = getEquivalence $ deciding1 (Proxy :: Proxy Eq) (Equivalence (==)) (Equivalence f)
deciding :: (Deciding q a, Decidable f) => p q -> (forall b . q b => f b) -> f acontravariant Data.Functor.Contravariant.Generic No documentation available.