Module
Data.Refined
- Package
- purescript-refined
- Repository
- danieljharvey/purescript-refined
#Refined Source
newtype Refined p xConstructors
Refined x
Instances
(Eq x) => Eq (Refined p x)(Show x) => Show (Refined p x)Generic (Refined p x) _(DecodeJson x, Show x, Predicate p x) => DecodeJson (Refined p x)(EncodeJson x) => EncodeJson (Refined p x)
#unsafeRefine Source
unsafeRefine :: forall x p. Predicate p x => x -> (Refined p x)Re-exports from Data.Refined.Error
#RefinedError Source
data RefinedError aConstructors
AndError (These (RefinedError a) (RefinedError a))OrError (RefinedError a) (RefinedError a)SizeEqualToError Int aSizeGreaterThanError Int aSizeLessThanError Int aNotErrorLessThanError Int aGreaterThanError Int aFromError Int aToError Int aFromToError Int Int aEqualToError Int aNotEqualToError Int a
Instances
(Eq a) => Eq (RefinedError a)(Show a) => Show (RefinedError a)
Re-exports from Data.Refined.Internal
Re-exports from Data.Refined.Predicate
#SizeLessThan Source
data SizeLessThan aA 'Predicate' ensuring that the length of a foldable is less than a given int
Instances
(Predicate a x, Foldable t, Nat n) => Predicate (SizeLessThan n) (t a)
#SizeGreaterThan Source
data SizeGreaterThan aA 'Predicate' ensuring that the length of a foldable is greater than a given int
Instances
(Predicate a x, Foldable t, Nat n) => Predicate (SizeGreaterThan n) (t a)
#SizeEqualTo Source
data SizeEqualTo aA 'Predicate' ensuring that the length of a foldable is equal to a given int
Instances
(Predicate a x, Foldable t, Nat n) => Predicate (SizeEqualTo n) (t a)
#Positive Source
type Positive = GreaterThan D0A 'Predicate' ensuring that the value is greater than zero.
#NotEqualTo Source
data NotEqualTo nA 'Predicate' ensuring that the value is not equal to a given int
Instances
(Nat n, Eq x, Ring x) => Predicate (NotEqualTo n) x
#NonZero Source
type NonZero = NotEqualTo D0A 'Predicate' ensuring that the value is not equal to zero.
#NonNegative Source
type NonNegative = From D0A 'Predicate' ensuring that the value is greater than or equal to zero.
#NonEmpty Source
type NonEmpty = SizeGreaterThan D0A 'Predicate' ensuring that the 'Foldable' is non-empty.
#GreaterThan Source
data GreaterThan nA 'Predicate' ensuring that the value is greater than a given int
Instances
(Nat n, Ord x, Ring x) => Predicate (GreaterThan n) x
#Predicate Source
class Predicate p x whereMembers
validate :: p -> x -> Either (RefinedError x) x
Instances
Predicate IdPred x(Predicate l x, Predicate r x) => Predicate (And l r) x(Predicate l x, Predicate r x) => Predicate (Or l r) x(Predicate a x, Foldable t, Nat n) => Predicate (SizeEqualTo n) (t a)(Predicate a x, Foldable t, Nat n) => Predicate (SizeGreaterThan n) (t a)(Predicate a x, Foldable t, Nat n) => Predicate (SizeLessThan n) (t a)(Predicate a x) => Predicate (Not a) x(Nat n, Ord x, Ring x) => Predicate (LessThan n) x(Nat n, Ord x, Ring x) => Predicate (GreaterThan n) x(Nat n, Ord x, Ring x) => Predicate (From n) x(Nat n, Ord x, Ring x) => Predicate (To n) x(Nat n, Nat m, Ord x, Ring x) => Predicate (FromTo m n) x(Nat n, Eq x, Ring x) => Predicate (EqualTo n) x(Nat n, Eq x, Ring x) => Predicate (NotEqualTo n) x