partial-order-0.2.0.0: Provides typeclass suitable for types admitting a partial order
Copyright (c) 2016 Moritz Schulte
License BSD3
Maintainer mtesseract@silverratio.net
Stability experimental
Portability POSIX
Safe Haskell Safe-Inferred
Language Haskell2010

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

Instances details
PartialOrd Double Source #
Instance details

Defined in Data.PartialOrd

PartialOrd Float Source #
Instance details

Defined in Data.PartialOrd

PartialOrd Int Source #

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

Instance details

Defined in Data.PartialOrd

PartialOrd Integer Source #
Instance details

Defined in Data.PartialOrd

PartialOrd a => PartialOrd [a] Source #

Define the partial order in terms of the sublist relation.

Instance details

Defined in Data.PartialOrd

Ord a => PartialOrd ( Set a) Source #

Define the partial order in terms of the subset relation.

Instance details

Defined in Data.PartialOrd

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.