Data.Functor.Contravariant.Generic

contravariant-1.5.5: Contravariant functors

Copyright | (C) 2007-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | ConstraintKinds
Safe Haskell | Safe
Language | Haskell2010

Data.Functor.Contravariant.Generic

Description

Synopsis

- class (Generic a, GDeciding q (Rep' a)) => Deciding (q :: Type -> Constraint) a where
  - deciding :: Decidable f => p q -> (forall b. q b => f b) -> f a
- class (Generic1 t, GDeciding1 q (Rep1' t)) => Deciding1 (q :: Type -> Constraint) (t :: Type -> Type) where
  - deciding1 :: Decidable f => p q -> (forall b. q b => f b) -> f a -> f (t a)

# Documentation

class (Generic a, GDeciding q (Rep' a)) => Deciding (q :: Type -> Constraint) a where #

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 (==))

Methods

deciding :: Decidable f => p q -> (forall b. q b => f b) -> f a #

#### Instances

Instances details

(Generic a, GG (Rep a), GDeciding q (Rep' a)) => Deciding q a # |
Instance details Defined in Data.Functor.Contravariant.Generic Methods deciding :: Decidable f => p q -> (forall b. q b => f b) -> f a #

class (Generic1 t, GDeciding1 q (Rep1' t)) => Deciding1 (q :: Type -> Constraint) (t :: Type -> Type) where #

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)

Methods

deciding1 :: Decidable f => p q -> (forall b. q b => f b) -> f a -> f (t a) #

#### Instances

Instances details

(Generic1 t, GDeciding1 q (Rep1' t), GG (Rep1 t)) => Deciding1 q t # |
Instance details Defined in Data.Functor.Contravariant.Generic Methods deciding1 :: Decidable f => p q -> (forall b. q b => f b) -> f a -> f (t a) #