summaryrefslogtreecommitdiff
path: root/lib/SuperOrd.hs
blob: 258a823f1b3ef109558f351cc77642b29111b83a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module SuperOrd where

data SuperOrd a
        = NegativeInfinity
        | SuperOrd { superApprox        :: !a
                   , superCompareApprox :: !Ordering
                   }
        | PositiveInfinity
  deriving (Eq, Ord, Show)

instance Bounded (SuperOrd a) where
    minBound = NegativeInfinity
    maxBound = PositiveInfinity

exactly :: a -> SuperOrd a
exactly a = SuperOrd a EQ

lessThan :: a -> SuperOrd a
lessThan a = SuperOrd a LT

greaterThan :: a -> SuperOrd a
greaterThan a = SuperOrd a GT