numeric-prelude-0.1.1: An experimental alternative hierarchy of numeric type classesSource codeContentsIndex
Algebra.Indexable
Portabilityportable
Stabilityprovisional
Maintainernumericprelude@henning-thielemann.de
Description
An alternative type class for Ord which allows an ordering for dictionaries like Data.Map and Data.Set independently from the ordering with respect to a magnitude.
Synopsis
class Eq a => C a where
compare :: a -> a -> Ordering
ordCompare :: Ord a => a -> a -> Ordering
liftCompare :: C b => (a -> b) -> a -> a -> Ordering
data ToOrd a
toOrd :: a -> ToOrd a
fromOrd :: ToOrd a -> a
Documentation
class Eq a => C a whereSource
Definition of an alternative ordering of objects independent from a notion of magnitude. For an application see MathObj.PartialFraction.
Methods
compare :: a -> a -> OrderingSource
show/hide Instances
C Integer
C T
C a => C ([] a)
(Ord a, C a) => C (T a)
(C a, C a) => C (T a)
C a => C (T a)
(C a, C b) => C ((,) a b)
ordCompare :: Ord a => a -> a -> OrderingSource
If the type has already an Ord instance it is certainly the most easiest to define compare to be equal to Ord's compare.
liftCompare :: C b => (a -> b) -> a -> a -> OrderingSource
Lift compare implementation from a wrapped object.
data ToOrd a Source
Wrap an indexable object such that it can be used in Data.Map and Data.Set.
show/hide Instances
Eq a => Eq (ToOrd a)
C a => Ord (ToOrd a)
Show a => Show (ToOrd a)
toOrd :: a -> ToOrd aSource
fromOrd :: ToOrd a -> aSource
Produced by Haddock version 2.4.2