semilattices-0.0.0.7: Semilattices
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Semilattice.Meet

Description

Join semilattices, related to Lower and Upper.

Synopsis

Documentation

class Meet s where Source #

A meet semilattice is an idempotent commutative semigroup.

Methods

(/\) :: s -> s -> s infixr 7 Source #

The meet operation.

Laws:

Idempotence:

x /\ x = x

Associativity:

a /\ (b /\ c) = (a /\ b) /\ c

Commutativity:

a /\ b = b /\ a

Additionally, if s has an Upper bound, then upperBound must be its identity:

upperBound /\ a = a
a /\ upperBound = a

If s has a Lower bound, then lowerBound must be its absorbing element:

lowerBound /\ a = lowerBound
a /\ lowerBound = lowerBound

Instances

Instances details
Meet IntSet Source #

IntSet intersection forms a semilattice.

Idempotence:

x /\ x == (x :: IntSet)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: IntSet)

Commutativity:

a /\ b == b /\ (a :: IntSet)

Absorption:

lowerBound /\ a == (lowerBound :: IntSet)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: IntSet -> IntSet -> IntSet Source #

Meet Ordering Source #

Orderings form a semilattice.

Idempotence:

x /\ x == (x :: Ordering)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Ordering)

Commutativity:

a /\ b == b /\ (a :: Ordering)

Identity:

upperBound /\ a == (a :: Ordering)

Absorption:

lowerBound /\ a == (lowerBound :: Ordering)
Instance details

Defined in Data.Semilattice.Meet

Meet () Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: () -> () -> () Source #

Meet Bool Source #

Boolean conjunction forms a semilattice.

Idempotence:

x /\ x == (x :: Bool)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Bool)

Commutativity:

a /\ b == b /\ (a :: Bool)

Identity:

upperBound /\ a == (a :: Bool)

Absorption:

lowerBound /\ a == (lowerBound :: Bool)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Bool -> Bool -> Bool Source #

Ord a => Meet (Min a) Source #

The greatest lowerBound bound gives rise to a meet semilattice.

Idempotence:

x /\ x == (x :: Min Int)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Min Int)

Commutativity:

a /\ b == b /\ (a :: Min Int)

Identity:

upperBound /\ a == (a :: Min Int)

Absorption:

lowerBound /\ a == (lowerBound :: Min Int)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Min a -> Min a -> Min a Source #

Meet a => Meet (IntMap a) Source #

IntMap union with Meetable values forms a semilattice.

Idempotence:

x /\ x == (x :: IntMap (Set Char))

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: IntMap (Set Char))

Commutativity:

a /\ b == b /\ (a :: IntMap (Set Char))

Absorption:

lowerBound /\ a == (lowerBound :: IntMap (Set Char))
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: IntMap a -> IntMap a -> IntMap a Source #

Ord a => Meet (Set a) Source #

Set intersection forms a semilattice.

Idempotence:

x /\ x == (x :: Set Char)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Set Char)

Commutativity:

a /\ b == b /\ (a :: Set Char)

Absorption:

lowerBound /\ a == (lowerBound :: Set Char)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Set a -> Set a -> Set a Source #

Eq a => Meet (HashSet a) Source #

HashSet intersection forms a semilattice.

Idempotence:

x /\ x == (x :: HashSet Char)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: HashSet Char)

Commutativity:

a /\ b == b /\ (a :: HashSet Char)

Absorption:

lowerBound /\ a == (lowerBound :: HashSet Char)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: HashSet a -> HashSet a -> HashSet a Source #

Meet a => Meet (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Meet a => Meet (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Meeting a -> Meeting a -> Meeting a Source #

Ord a => Meet (Order a) Source #

Total Orderings give rise to a meet semilattice satisfying:

Idempotence:

Order x /\ Order x == Order x

Associativity:

Order a /\ (Order b /\ Order c) == (Order a /\ Order b) /\ Order c

Commutativity:

Order a /\ Order b == Order b /\ Order a

Identity:

upperBound /\ Order a == Order (a :: Int)

Absorption:

lowerBound /\ Order a == (lowerBound :: Order Int)

Distributivity:

Order a /\ (Order b \/ Order c) == Order a /\ Order b \/ Order a /\ Order c
Instance details

Defined in Data.Semilattice.Order

Methods

(/\) :: Order a -> Order a -> Order a Source #

Join a => Meet (Tumble a) Source # 
Instance details

Defined in Data.Semilattice.Tumble

Methods

(/\) :: Tumble a -> Tumble a -> Tumble a Source #

(Ord k, Meet a) => Meet (Map k a) Source #

Map union with Meetable values forms a semilattice.

Idempotence:

x /\ x == (x :: Map Char (Set Char))

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Map Char (Set Char))

Commutativity:

a /\ b == b /\ (a :: Map Char (Set Char))

Absorption:

lowerBound /\ a == (lowerBound :: Map Char (Set Char))
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Map k a -> Map k a -> Map k a Source #

(Eq k, Meet a) => Meet (HashMap k a) Source #

HashMap union with Meetable values forms a semilattice.

Idempotence:

x /\ x == (x :: HashMap Char (Set Char))

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: HashMap Char (Set Char))

Commutativity:

a /\ b == b /\ (a :: HashMap Char (Set Char))

Absorption:

lowerBound /\ a == (lowerBound :: HashMap Char (Set Char))
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: HashMap k a -> HashMap k a -> HashMap k a Source #

Meet b => Meet (a -> b) Source #

Functions with semilattice codomains form a semilattice.

Idempotence:

\ (Fn x) -> x /\ x ~= (x :: Int -> Bool)

Associativity:

\ (Fn a) (Fn b) (Fn c) -> a /\ (b /\ c) ~= (a /\ b) /\ (c :: Int -> Bool)

Commutativity:

\ (Fn a) (Fn b) -> a /\ b ~= b /\ (a :: Int -> Bool)

Identity:

\ (Fn a) -> upperBound /\ a ~= (a :: Int -> Bool)

Absorption:

\ (Fn a) -> lowerBound /\ a ~= (lowerBound :: Int -> Bool)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: (a -> b) -> (a -> b) -> a -> b Source #

newtype Meeting a Source #

A Semigroup for any Meet semilattice.

If the semilattice has an Upper bound, there is additionally a Monoid instance.

Constructors

Meeting 

Fields

Instances

Instances details
Foldable Meeting Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

fold :: Monoid m => Meeting m -> m #

foldMap :: Monoid m => (a -> m) -> Meeting a -> m #

foldMap' :: Monoid m => (a -> m) -> Meeting a -> m #

foldr :: (a -> b -> b) -> b -> Meeting a -> b #

foldr' :: (a -> b -> b) -> b -> Meeting a -> b #

foldl :: (b -> a -> b) -> b -> Meeting a -> b #

foldl' :: (b -> a -> b) -> b -> Meeting a -> b #

foldr1 :: (a -> a -> a) -> Meeting a -> a #

foldl1 :: (a -> a -> a) -> Meeting a -> a #

toList :: Meeting a -> [a] #

null :: Meeting a -> Bool #

length :: Meeting a -> Int #

elem :: Eq a => a -> Meeting a -> Bool #

maximum :: Ord a => Meeting a -> a #

minimum :: Ord a => Meeting a -> a #

sum :: Num a => Meeting a -> a #

product :: Num a => Meeting a -> a #

Traversable Meeting Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

traverse :: Applicative f => (a -> f b) -> Meeting a -> f (Meeting b) #

sequenceA :: Applicative f => Meeting (f a) -> f (Meeting a) #

mapM :: Monad m => (a -> m b) -> Meeting a -> m (Meeting b) #

sequence :: Monad m => Meeting (m a) -> m (Meeting a) #

Functor Meeting Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

fmap :: (a -> b) -> Meeting a -> Meeting b #

(<$) :: a -> Meeting b -> Meeting a #

(Upper a, Meet a) => Monoid (Meeting a) Source #

Meeting mempty is the left- and right-identity.

let (l, r) = (mappend mempty (Meeting x), mappend (Meeting x) mempty) in l == Meeting x && r == Meeting (x :: Bool)
Instance details

Defined in Data.Semilattice.Meet

Methods

mempty :: Meeting a #

mappend :: Meeting a -> Meeting a -> Meeting a #

mconcat :: [Meeting a] -> Meeting a #

Meet a => Semigroup (Meeting a) Source #

Meeting <> is associative.

Meeting a <> (Meeting b <> Meeting c) == (Meeting a <> Meeting b) <> Meeting (c :: IntSet)
Instance details

Defined in Data.Semilattice.Meet

Methods

(<>) :: Meeting a -> Meeting a -> Meeting a #

sconcat :: NonEmpty (Meeting a) -> Meeting a #

stimes :: Integral b => b -> Meeting a -> Meeting a #

Bounded a => Bounded (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Enum a => Enum (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

succ :: Meeting a -> Meeting a #

pred :: Meeting a -> Meeting a #

toEnum :: Int -> Meeting a #

fromEnum :: Meeting a -> Int #

enumFrom :: Meeting a -> [Meeting a] #

enumFromThen :: Meeting a -> Meeting a -> [Meeting a] #

enumFromTo :: Meeting a -> Meeting a -> [Meeting a] #

enumFromThenTo :: Meeting a -> Meeting a -> Meeting a -> [Meeting a] #

Num a => Num (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

(+) :: Meeting a -> Meeting a -> Meeting a #

(-) :: Meeting a -> Meeting a -> Meeting a #

(*) :: Meeting a -> Meeting a -> Meeting a #

negate :: Meeting a -> Meeting a #

abs :: Meeting a -> Meeting a #

signum :: Meeting a -> Meeting a #

fromInteger :: Integer -> Meeting a #

Read a => Read (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Show a => Show (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

showsPrec :: Int -> Meeting a -> ShowS #

show :: Meeting a -> String #

showList :: [Meeting a] -> ShowS #

Eq a => Eq (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

(==) :: Meeting a -> Meeting a -> Bool #

(/=) :: Meeting a -> Meeting a -> Bool #

Ord a => Ord (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

compare :: Meeting a -> Meeting a -> Ordering #

(<) :: Meeting a -> Meeting a -> Bool #

(<=) :: Meeting a -> Meeting a -> Bool #

(>) :: Meeting a -> Meeting a -> Bool #

(>=) :: Meeting a -> Meeting a -> Bool #

max :: Meeting a -> Meeting a -> Meeting a #

min :: Meeting a -> Meeting a -> Meeting a #

Meet a => Meet (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Meeting a -> Meeting a -> Meeting a Source #

Upper a => Upper (Meeting a) Source # 
Instance details

Defined in Data.Semilattice.Meet

newtype GreaterThan a Source #

Meet semilattices give rise to a partial Ordering.

Constructors

GreaterThan 

Fields

Instances

Instances details
Foldable GreaterThan Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

fold :: Monoid m => GreaterThan m -> m #

foldMap :: Monoid m => (a -> m) -> GreaterThan a -> m #

foldMap' :: Monoid m => (a -> m) -> GreaterThan a -> m #

foldr :: (a -> b -> b) -> b -> GreaterThan a -> b #

foldr' :: (a -> b -> b) -> b -> GreaterThan a -> b #

foldl :: (b -> a -> b) -> b -> GreaterThan a -> b #

foldl' :: (b -> a -> b) -> b -> GreaterThan a -> b #

foldr1 :: (a -> a -> a) -> GreaterThan a -> a #

foldl1 :: (a -> a -> a) -> GreaterThan a -> a #

toList :: GreaterThan a -> [a] #

null :: GreaterThan a -> Bool #

length :: GreaterThan a -> Int #

elem :: Eq a => a -> GreaterThan a -> Bool #

maximum :: Ord a => GreaterThan a -> a #

minimum :: Ord a => GreaterThan a -> a #

sum :: Num a => GreaterThan a -> a #

product :: Num a => GreaterThan a -> a #

Traversable GreaterThan Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

traverse :: Applicative f => (a -> f b) -> GreaterThan a -> f (GreaterThan b) #

sequenceA :: Applicative f => GreaterThan (f a) -> f (GreaterThan a) #

mapM :: Monad m => (a -> m b) -> GreaterThan a -> m (GreaterThan b) #

sequence :: Monad m => GreaterThan (m a) -> m (GreaterThan a) #

Functor GreaterThan Source # 
Instance details

Defined in Data.Semilattice.Meet

Methods

fmap :: (a -> b) -> GreaterThan a -> GreaterThan b #

(<$) :: a -> GreaterThan b -> GreaterThan a #

Enum a => Enum (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Num a => Num (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Read a => Read (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Show a => Show (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet

Eq a => Eq (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet

(Eq a, Meet a) => Ord (GreaterThan a) Source #

NB: This is not in general a total ordering.

Instance details

Defined in Data.Semilattice.Meet

Meet a => Meet (GreaterThan a) Source # 
Instance details

Defined in Data.Semilattice.Meet