partial-order-0.1.0: Provides typeclass suitable for types admitting a partial order

Copyright(c) 2016 Moritz Schulte
LicenseBSD3
Maintainermtesseract@silverratio.net
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Data.PartialOrd

Description

This module provides the PartialOrd typeclass suitable for types admitting a partial order.

Along with the PartialOrd typeclass and some utility functions for working with partially ordered types, it exports implementations for the numeric types several numeric types, lists and sets.

Synopsis

Documentation

class PartialOrd a where Source #

Minimal complete definition

(<=)

Methods

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

Less-than-or-equal relation.

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

Bigger-than-or-equal relation. Defined in terms of <=.

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

Equality relation. Defined in terms of <=.

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

Inequality relation. Defined in terms of ==.

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

Less-than relation relation. Defined in terms of <= and /=.

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

Bigger-than relation. Defined in terms of <= and /=.

compare :: a -> a -> Maybe Ordering Source #

Compare function, returning either Just an Ordering or Nothing.

Instances

PartialOrd Double Source # 
PartialOrd Float Source # 
PartialOrd Int Source #

Derive the partial order from the total order for the following types:

Methods

(<=) :: Int -> Int -> Bool Source #

(>=) :: Int -> Int -> Bool Source #

(==) :: Int -> Int -> Bool Source #

(/=) :: Int -> Int -> Bool Source #

(<) :: Int -> Int -> Bool Source #

(>) :: Int -> Int -> Bool Source #

compare :: Int -> Int -> Maybe Ordering Source #

PartialOrd Integer Source # 
PartialOrd a => PartialOrd [a] Source #

Define the partial order in terms of the sublist relation.

Methods

(<=) :: [a] -> [a] -> Bool Source #

(>=) :: [a] -> [a] -> Bool Source #

(==) :: [a] -> [a] -> Bool Source #

(/=) :: [a] -> [a] -> Bool Source #

(<) :: [a] -> [a] -> Bool Source #

(>) :: [a] -> [a] -> Bool Source #

compare :: [a] -> [a] -> Maybe Ordering Source #

Ord a => PartialOrd (Set a) Source #

Define the partial order in terms of the subset relation.

Methods

(<=) :: Set a -> Set a -> Bool Source #

(>=) :: Set a -> Set a -> Bool Source #

(==) :: Set a -> Set a -> Bool Source #

(/=) :: Set a -> Set a -> Bool Source #

(<) :: Set a -> Set a -> Bool Source #

(>) :: Set a -> Set a -> Bool Source #

compare :: Set a -> Set a -> Maybe Ordering Source #

maxima :: PartialOrd a => [a] -> [a] Source #

Compute the list of all elements that are not less than any other element in the list.

minima :: PartialOrd a => [a] -> [a] Source #

Compute the list of all elements that are not bigger than any other element in the list.

elem :: (PartialOrd a, Foldable t) => a -> t a -> Bool Source #

Version of the traditional elem function using the PartialOrd notion of equality.

notElem :: (PartialOrd a, Foldable t) => a -> t a -> Bool Source #

Version of the traditional notElem function using the PartialOrd notion of equality.

nub :: PartialOrd a => [a] -> [a] Source #

Version of the traditional nub function using the PartialOrd notion of equality.