Safe Haskell | None |
---|---|
Language | Haskell2010 |
promoted Ordering
functions
Synopsis
- data p > q
- data p >= q
- data p == q
- data p /= q
- data p <= q
- data p < q
- data p >~ q
- data p >=~ q
- data p ==~ q
- data p /=~ q
- data p <=~ q
- data p <~ q
- type Gt n = I > n
- type Ge n = I >= n
- type Same n = I == n
- type Le n = I <= n
- type Lt n = I < n
- type Ne n = I /= n
- data p ==! q
- type OrdP p q = p ==! q
- data OrdA' p q
- data OrdA p
- type OrdI p q = p ===~ q
- data p ===~ q
- data Cmp (o :: OrderingP) p q
- data CmpI (o :: OrderingP) p q
- data Asc
- data Asc'
- data Desc
- data Desc'
- data AllPositive
- type Positive = Gt 0
- data AllNegative
- type Negative = Lt 0
- data Ands p
- data Ors p
compare expressions
compare if expression 'p' is greater than 'q'
>>>
pl @(Id > "xx") "abc"
False ("abc" > "xx") FalseT
>>>
pl @(Id > "aa") "abc"
True ("abc" > "aa") TrueT
>>>
pl @(Fst Id > Snd Id) (True,False)
True (True > False) TrueT
compare if expression 'p' is greater than or equal to 'q'
compare if expression 'p' is equal to 'q'
>>>
pl @(Fst Id == Snd Id) ("ab","xyzabw")
False ("ab" == "xyzabw") FalseT
>>>
pl @(Fst Id == Snd Id) ("aBc","AbC")
False ("aBc" == "AbC") FalseT
>>>
pz @(Fst Id == Snd Id) ("aBc","aBc")
TrueT
>>>
pl @(Id == "Abc") "abc"
False ("abc" == "Abc") FalseT
>>>
pl @(Fst Id == Snd Id) (True,False)
False (True == False) FalseT
>>>
pl @(Not Id *** Id >> Fst Id == Snd Id) (True,False)
True ((>>) True | {False == False}) TrueT
compare if expression 'p' is not equal to 'q'
>>>
pl @(Fst Id /= Snd Id) ("ab","xyzabw")
True ("ab" /= "xyzabw") TrueT
compare if expression 'p' is less than or equal to 'q'
>>>
pl @(Not (Fst Id >> Len <= 6)) ([2..7],True)
False (Not ((>>) True | {6 <= 6})) FalseT
>>>
pl @(Fst Id >> Len <= 6) ([2..7],True)
True ((>>) True | {6 <= 6}) TrueT
>>>
pl @(Length (Fst Id) <= 6) ([2..7],True)
True (6 <= 6) TrueT
>>>
pl @(Fst Id >> (Len <= 6)) ([2..7],True)
True ((>>) True | {6 <= 6}) TrueT
compare if expression 'p' is less than 'q'
case-insensitive compare if string expression 'p' is greater than 'q'
case-insensitive compare if string expression 'p' is greater than or equal to 'q'
case-insensitive compare if string expression 'p' is equal to 'q'
case-insensitive compare if string expression 'p' is not equal to 'q'
case-insensitive compare if string expression 'p' is less than or equal to 'q'
case-insensitive compare if string expression 'p' is less than 'q'
compare if expression 'p' is greater than 'q'
>>>
pl @(Gt 4) 5
True (5 > 4) TrueT
similar to compare
>>>
pz @(Fst Id ==! Snd Id) (10,9)
PresentT GT
>>>
pz @(14 % 3 ==! Fst Id -% Snd Id) (-10,7)
PresentT GT
>>>
pz @(Fst Id ==! Snd Id) (10,11)
PresentT LT
>>>
pz @(Snd Id ==! (Fst Id >> Snd Id >> Head Id)) (('x',[10,12,13]),10)
PresentT EQ
>>>
pz @(Snd Id ==! Head (Snd (Fst Id))) (('x',[10,12,13]),10)
PresentT EQ
>>>
pl @("aa" ==! Id) "aaaa"
Present LT ((==!) "aa" < "aaaa") PresentT LT
>>>
pl @(Pairs >> Map (First (Succ Id >> Succ Id) >> Fst Id ==! Snd Id) Id) [1,2,3,6,8]
Present [GT,GT,LT,EQ] ((>>) [GT,GT,LT,EQ] | {Map [GT,GT,LT,EQ] | [(1,2),(2,3),(3,6),(6,8)]}) PresentT [GT,GT,LT,EQ]
>>>
pl @((Ones Id << ShowP Id) >> Map (Fst Id ==! Snd Id) Pairs) 1234223
Present [LT,LT,LT,GT,EQ,LT] ((>>) [LT,LT,LT,GT,EQ,LT] | {Map [LT,LT,LT,GT,EQ,LT] | [("1","2"),("2","3"),("3","4"),("4","2"),("2","2"),("2","3")]}) PresentT [LT,LT,LT,GT,EQ,LT]
>>>
pl @("Abc" ==! Id) "abc"
Present LT ((==!) "Abc" < "abc") PresentT LT
>>>
pl @(Fst Id ==! Snd Id) (3,12)
Present LT ((==!) 3 < 12) PresentT LT
>>>
pl @(Fst Id ==! Snd Id) ("aBc","AbC")
Present GT ((==!) "aBc" > "AbC") PresentT GT
>>>
pl @(Snd Id ==! Fst Id) ("aBc","AbC")
Present LT ((==!) "AbC" < "aBc") PresentT LT
similar to compare
but using a tuple as input
type OrdI p q = p ===~ q Source #
compare two strings ignoring case and return an ordering
>>>
pz @(Fst Id ===~ Snd Id) ("abC","aBc")
PresentT EQ
>>>
pz @(Fst Id ===~ Snd Id) ("abC","DaBc")
PresentT LT
>>>
pl @(Fst Id ===~ Snd Id &&& Fst Id ==! Snd Id) ("abc","abc")
Present (EQ,EQ) (W '(EQ,EQ)) PresentT (EQ,EQ)
>>>
pl @(Fst Id ===~ Snd Id) ("aBc","AbC")
Present EQ ((===~) aBc = AbC) PresentT EQ
>>>
pl @("Abc" ===~ Id) "abc"
Present EQ ((===~) Abc = abc) PresentT EQ
>>>
pl @("Abc" ==~ Id) "abc"
True (Abc ==~ abc) TrueT
>>>
pl @(Fst Id ==~ Snd Id) ("aBc","AbC")
True (aBc ==~ AbC) TrueT
>>>
pl @(Fst Id ==~ Snd Id && Fst Id == Snd Id) ("Abc","Abc")
True (True && True) TrueT
data Cmp (o :: OrderingP) p q Source #
compare two values using the given ordering 'o'
>>>
pl @(Lt 4) 123
False (123 < 4) FalseT
>>>
pl @(Lt 4) 1
True (1 < 4) TrueT
>>>
pl @(Negate 7 <..> 20) (-4)
True (-7 <= -4 <= 20) TrueT
>>>
pl @(Negate 7 <..> 20) 21
False (21 <= 20) FalseT
data CmpI (o :: OrderingP) p q Source #
compare two strings ignoring case using the given ordering 'o'
a type level predicate for a monotonic increasing list
>>>
pl @Asc "aaacdef"
True (All(6)) TrueT
>>>
pz @Asc [1,2,3,4,5,5,7]
TrueT
>>>
pz @Asc "axacdef"
FalseT
a type level predicate for a strictly increasing list
>>>
pz @Asc' [1,2,3,4,5,5,7]
FalseT
a type level predicate for a monotonic decreasing list
a type level predicate for a strictly decreasing list
data AllPositive Source #
a type level predicate for all positive elements in a list
>>>
pz @AllPositive [1,5,10,2,3]
TrueT
>>>
pz @AllPositive [0,1,5,10,2,3]
FalseT
>>>
pz @AllPositive [3,1,-5,10,2,3]
FalseT
Instances
P AllPositiveT x => P AllPositive x Source # | |
Defined in Predicate.Data.Ordering type PP AllPositive x :: Type Source # eval :: MonadEval m => proxy AllPositive -> POpts -> x -> m (TT (PP AllPositive x)) Source # | |
type PP AllPositive x Source # | |
Defined in Predicate.Data.Ordering |
data AllNegative Source #
a type level predicate for all negative elements in a list
>>>
pz @AllNegative [-1,-5,-10,-2,-3]
TrueT
Instances
P AllNegativeT x => P AllNegative x Source # | |
Defined in Predicate.Data.Ordering type PP AllNegative x :: Type Source # eval :: MonadEval m => proxy AllNegative -> POpts -> x -> m (TT (PP AllNegative x)) Source # | |
type PP AllNegative x Source # | |
Defined in Predicate.Data.Ordering |
similar to and
>>>
pz @(Ands Id) [True,True,True]
TrueT
>>>
pl @(Ands Id) [True,True,True,False]
False (Ands(4) i=3 | [True,True,True,False]) FalseT
>>>
pz @(Ands Id) []
TrueT
similar to or
>>>
pz @(Ors Id) [False,False,False]
FalseT
>>>
pl @(Ors Id) [True,True,True,False]
True (Ors(4) i=0 | [True,True,True,False]) TrueT
>>>
pl @(Ors Id) []
False (Ors(0) | []) FalseT