partial-order-0.1.2.1: 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 #

Minimal complete definition

(<=)

Methods

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

Less-than-or-equal relation.

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

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

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

Equality relation. Defined in terms of <=.

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

Inequality relation. Defined in terms of ==.

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

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

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

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

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

Compare function, returning either Just an Ordering or Nothing.

Instances

PartialOrd Double # 
PartialOrd Float # 

Methods

(<=) :: Float -> Float -> Bool #

(>=) :: Float -> Float -> Bool #

(==) :: Float -> Float -> Bool #

(/=) :: Float -> Float -> Bool #

(<) :: Float -> Float -> Bool #

(>) :: Float -> Float -> Bool #

compare :: Float -> Float -> Maybe Ordering #

PartialOrd Int #

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

Methods

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

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

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

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

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

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

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

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

Define the partial order in terms of the sublist relation.

Methods

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

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

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

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

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

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

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

Ord a => PartialOrd (Set a) #

Define the partial order in terms of the subset relation.

Methods

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

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

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

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

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

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

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

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

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

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

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 #

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

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

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

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

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