prednote-0.30.0.0: Evaluate and display trees of predicates

Safe HaskellSafe-Inferred
LanguageHaskell2010

Prednote.Comparisons

Contents

Synopsis

Comparisions that do not run in a context

compareBy Source

Arguments

:: Show a 
=> Text

Description of the right-hand side

-> (a -> Ordering)

How to compare the left-hand side to the right-hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Ordering

When subjects are compared, this ordering must be the result in order for the Predbox to be True; otherwise it is False. The subject will be on the left hand side.

-> Pred a 

Build a Pred that compares items. The idea is that the item on the right hand side is baked into the Pred and that the Pred compares this single right-hand side to each left-hand side item.

compare Source

Arguments

:: (Show a, Ord a) 
=> a

Right-hand side

-> Ordering

When subjects are compared, this ordering must be the result in order for the Predbox to be True; otherwise it is False. The subject will be on the left hand side.

-> Pred a 

Overloaded version of compareBy.

equalBy Source

Arguments

:: Show a 
=> Text

Description of the right-hand side

-> (a -> Bool)

How to compare an item against the right hand side. Return True if the items are equal; False otherwise.

-> Pred a 

Builds a Pred that tests items for equality.

equal Source

Arguments

:: (Eq a, Show a) 
=> a

Right-hand side

-> Pred a 

Overloaded version of equalBy.

compareByMaybe Source

Arguments

:: Show a 
=> Text

Description of the right-hand side

-> (a -> Maybe Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Ordering

When subjects are compared, this ordering must be the result in order for the Predbox to be True; otherwise it is False. The subject will be on the left hand side.

-> Pred a 

Builds a Pred for items that might fail to return a comparison.

greater Source

Arguments

:: (Show a, Ord a) 
=> a

Right-hand side

-> Pred a 

less Source

Arguments

:: (Show a, Ord a) 
=> a

Right-hand side

-> Pred a 

greaterEq Source

Arguments

:: (Show a, Ord a) 
=> a

Right-hand side

-> Pred a 

lessEq Source

Arguments

:: (Show a, Ord a) 
=> a

Right-hand side

-> Pred a 

notEq Source

Arguments

:: (Show a, Eq a) 
=> a

Right-hand side

-> Pred a 

greaterBy Source

Arguments

:: Show a 
=> Text

Description of right-hand side

-> (a -> Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Pred a 

lessBy Source

Arguments

:: Show a 
=> Text

Description of right-hand side

-> (a -> Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Pred a 

greaterEqBy Source

Arguments

:: Show a 
=> Text

Description of right-hand side

-> (a -> Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Pred a 

lessEqBy Source

Arguments

:: Show a 
=> Text

Description of right-hand side

-> (a -> Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Pred a 

notEqBy Source

Arguments

:: Show a 
=> Text

Description of right-hand side

-> (a -> Bool)

How to compare an item against the right hand side. Return True if equal; False otherwise.

-> Pred a 

Comparisions that run in a context

compareByM Source

Arguments

:: (Show a, Functor f) 
=> Text

Description of the right-hand side

-> (a -> f Ordering)

How to compare the left-hand side to the right-hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Ordering

When subjects are compared, this ordering must be the result in order for the Predbox to be True; otherwise it is False. The subject will be on the left hand side.

-> PredM f a 

Build a Pred that compares items. The idea is that the item on the right hand side is baked into the Pred and that the Pred compares this single right-hand side to each left-hand side item.

equalByM Source

Arguments

:: (Show a, Functor f) 
=> Text

Description of the right-hand side

-> (a -> f Bool)

How to compare an item against the right hand side. Return True if the items are equal; False otherwise.

-> PredM f a 

Builds a Pred that tests items for equality.

compareByMaybeM Source

Arguments

:: (Functor f, Show a) 
=> Text

Description of the right-hand side

-> (a -> f (Maybe Ordering))

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> Ordering

When subjects are compared, this ordering must be the result in order for the Predbox to be True; otherwise it is False. The subject will be on the left hand side.

-> PredM f a 

Builds a Pred for items that might fail to return a comparison.

greaterByM Source

Arguments

:: (Show a, Functor f) 
=> Text

Description of right-hand side

-> (a -> f Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> PredM f a 

lessByM Source

Arguments

:: (Show a, Functor f) 
=> Text

Description of right-hand side

-> (a -> f Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> PredM f a 

greaterEqByM Source

Arguments

:: (Functor f, Monad f, Show a) 
=> Text

Description of right-hand side

-> (a -> f Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> PredM f a 

lessEqByM Source

Arguments

:: (Functor f, Monad f, Show a) 
=> Text

Description of right-hand side

-> (a -> f Ordering)

How to compare an item against the right hand side. Return LT if the item is less than the right hand side; GT if greater; EQ if equal to the right hand side.

-> PredM f a 

notEqByM Source

Arguments

:: (Functor f, Show a) 
=> Text

Description of right-hand side

-> (a -> f Bool)

How to compare an item against the right hand side. Return True if equal; False otherwise.

-> PredM f a 

Parsing comparers

parseComparer Source

Arguments

:: (Monad f, Functor f) 
=> Text

The string with the comparer to be parsed

-> (Ordering -> PredM f a)

A function that, when given an ordering, returns a Pred. Typically you will get this by partial application of compare, compareBy, or compareByMaybe.

-> Maybe (PredM f a)

If an invalid comparer string is given, Nothing; otherwise, the Pred.

Parses a string that contains text, such as >=, which indicates which comparer to use. Returns the comparer.