@@ -17,6 +17,7 @@ instance numUnit :: Num Unit
17
17
instance eqUnit :: Eq Unit
18
18
instance ordUnit :: Ord Unit
19
19
instance boundedUnit :: Bounded Unit
20
+ instance boundedOrdUnit :: BoundedOrd Unit
20
21
instance booleanAlgebraUnit :: BooleanAlgebra Unit
21
22
instance showUnit :: Show Unit
22
23
```
@@ -713,6 +714,7 @@ instance semigroupOrdering :: Semigroup Ordering
713
714
instance eqOrdering :: Eq Ordering
714
715
instance ordOrdering :: Ord Ordering
715
716
instance boundedOrdering :: Bounded Ordering
717
+ instance boundedOrdOrdering :: BoundedOrd Ordering
716
718
instance showOrdering :: Show Ordering
717
719
```
718
720
@@ -785,7 +787,7 @@ Test whether one value is _non-strictly greater than_ another.
785
787
#### ` Bounded `
786
788
787
789
``` purescript
788
- class (Ord a) <= Bounded a where
790
+ class Bounded a where
789
791
top :: a
790
792
bottom :: a
791
793
```
@@ -796,14 +798,18 @@ instance boundedBoolean :: Bounded Boolean
796
798
instance boundedUnit :: Bounded Unit
797
799
instance boundedOrdering :: Bounded Ordering
798
800
instance boundedInt :: Bounded Int
801
+ instance boundedFn :: (Bounded b) => Bounded (a -> b)
799
802
```
800
803
801
- The ` Bounded ` type class represents types that are finite partially
802
- ordered sets.
804
+ The ` Bounded ` type class represents types that are finite.
803
805
804
- Instances should satisfy the following law in addition to the ` Ord ` laws:
806
+ Although there are no "internal" laws for ` Bounded ` , every value of ` a `
807
+ should be considered less than or equal to ` top ` by some means, and greater
808
+ than or equal to ` bottom ` .
805
809
806
- - Ordering: ` bottom <= a <= top `
810
+ The lack of explicit ` Ord ` constraint allows flexibility in the use of
811
+ ` Bounded ` so it can apply to total and partially ordered sets, boolean
812
+ algebras, etc.
807
813
808
814
#### ` BooleanAlgebra `
809
815
@@ -818,6 +824,7 @@ class (Bounded a) <= BooleanAlgebra a where
818
824
``` purescript
819
825
instance booleanAlgebraBoolean :: BooleanAlgebra Boolean
820
826
instance booleanAlgebraUnit :: BooleanAlgebra Unit
827
+ instance booleanAlgebraFn :: (BooleanAlgebra b) => BooleanAlgebra (a -> b)
821
828
```
822
829
823
830
The ` BooleanAlgebra ` type class represents types that behave like boolean
0 commit comments