refined-extras-0.1.0.0: Increased functionality for refined types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Refined.Extras.Predicates.Foldable

Contents

Description

Predicates for Foldable.

Since: 0.1.0.0

Synopsis

Elements

data All p Source #

Predicate for all elements satisfying some predicate.

Examples

Expand
>>> validate @(All NonZero) Proxy [1..5]
Nothing
>>> showRefineException <$> validate @(All NonZero) Proxy [0..5]
Just "RefineOtherException (NotEqualTo 0) \"Value does equal 0\""

Since: 0.1.0.0

Instances

Instances details
Predicate p Word8 => Predicate (All p :: Type) ByteString Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Predicate p Word8 => Predicate (All p :: Type) ByteString Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Predicate p Char => Predicate (All p :: Type) Text Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Predicate p Char => Predicate (All p :: Type) Text Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

(Foldable f, Predicate p a) => Predicate (All p :: Type) (f a) Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Methods

validate :: Proxy (All p) -> f a -> Maybe RefineException Source #

Generic (All p) Source # 
Instance details

Defined in Refined.Extras.Predicates.Foldable

Associated Types

type Rep (All p) :: Type -> Type Source #

Methods

from :: All p -> Rep (All p) x Source #

to :: Rep (All p) x -> All p Source #

type Rep (All p) Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

type Rep (All p) = D1 ('MetaData "All" "Refined.Extras.Predicates.Foldable" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Any p Source #

Predicate for any element satisfying some predicate.

Examples

Expand
>>> validate @(Any NonZero) Proxy [0,0,0,4]
Nothing
>>> showRefineException <$> validate @(Any NonZero) Proxy [0,0,0]
Just "RefineOtherException (NotEqualTo 0) \"No element satisfied the predicate\""

Since: 0.1.0.0

Instances

Instances details
Predicate p Word8 => Predicate (Any p :: Type) ByteString Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Predicate p Word8 => Predicate (Any p :: Type) ByteString Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Predicate p Char => Predicate (Any p :: Type) Text Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Predicate p Char => Predicate (Any p :: Type) Text Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

(Foldable f, Predicate p a) => Predicate (Any p :: Type) (f a) Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

Methods

validate :: Proxy (Any p) -> f a -> Maybe RefineException Source #

Generic (Any p) Source # 
Instance details

Defined in Refined.Extras.Predicates.Foldable

Associated Types

type Rep (Any p) :: Type -> Type Source #

Methods

from :: Any p -> Rep (Any p) x Source #

to :: Rep (Any p) x -> Any p Source #

type Rep (Any p) Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Foldable

type Rep (Any p) = D1 ('MetaData "Any" "Refined.Extras.Predicates.Foldable" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

type None p = Not (Any p) Source #

Predicate for no elements satisfying a predicate.

Examples

Expand
>>> validate @(None Negative) Proxy [3,4,5]
Nothing
>>> showRefineException <$> validate @(None Negative) Proxy [3,-1,2,5]
Just "RefineNotException (Not * (Any (LessThan 0)))"

Since: 0.1.0.0