unisonweb / base_v1

Unison base libraries, published using V1 codebase format
24 stars 14 forks source link

Universal min, max, and Ordering #50

Closed runarorama closed 4 years ago

runarorama commented 4 years ago

This PR adds Universal.min and Universal.max which uses universal ordering. Also adds the Ordering type and supporting functions.

Potentially controversial decisions:

Code review

The changes summarized below are available for you to review, using the following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/runarorama/mybase:._topic.ordering

Updates:

 patch patch (added 4 updates)

Added definitions:

 unique type Ordering (+3 metadata)
 Ordering.Equal                         : Ordering
 Ordering.Greater                       : Ordering
 Ordering.Less                          : Ordering
 Ordering.andThen                       : Ordering
                                        -> Ordering
                                        -> Ordering (+3 metadata)
 Ordering.andThen.doc                   : Doc (+2 metadata)
 Ordering.andThen.example.ex1           : Ordering (+2 metadata)
 Ordering.doc                           : Doc (+2 metadata)
 Universal.compareOn                    : (a ->{e} x)
                                        -> a
                                        -> a
                                        ->{e} Ordering (+3 metadata)
 Universal.compareOn.doc                : Doc (+2 metadata)
 Universal.max                          : a -> a -> a (+3 metadata)
 Universal.max.doc                      : Doc (+2 metadata)
 Universal.max.tests.absorption         : [Test.Result] (+2 metadata)
 Universal.max.tests.associative        : [Test.Result] (+4 metadata)
 Universal.max.tests.commutative        : [Test.Result] (+4 metadata)
 Universal.max.tests.distributesOverMin : [Test.Result] (+2 metadata)
 Universal.max.tests.idempotent         : [Test.Result] (+2 metadata)
 Universal.max.tests.partialOrder       : [Test.Result] (+4 metadata)
 Universal.min                          : a -> a -> a (+3 metadata)
 Universal.min.doc                      : Doc (+2 metadata)
 Universal.min.tests.absorption         : [Test.Result] (+4 metadata)
 Universal.min.tests.associative        : [Test.Result] (+3 metadata)
 Universal.min.tests.commutative        : [Test.Result] (+3 metadata)
 Universal.min.tests.distributesOverMax : [Test.Result] (+2 metadata)
 Universal.min.tests.idempotent         : [Test.Result] (+2 metadata)
 Universal.min.tests.partialOrder       : [Test.Result] (+2 metadata)
 Universal.ordering                     : a -> a -> Ordering (+3 metadata)
 Universal.ordering.doc                 : Doc (+2 metadata)
 Universal.ordering.doc.snippet1        : Doc (+2 metadata)

Removed definitions:

 Int.max                           : Int -> Int -> Int
 Int.max.doc                       : Doc
 ┌ Int.max.tests.absorption        : [Test.Result]
 └ Int.min.tests.absorption
 Int.max.tests.associative         : [Test.Result]
 Int.max.tests.commutative         : [Test.Result]
 Int.max.tests.deMorgan            : [Test.Result]
 Int.max.tests.distributesOverMin  : [Test.Result]
 Int.max.tests.idempotent          : [Test.Result]
 Int.max.tests.partialOrder        : [Test.Result]
 Int.max.tests.top                 : [Test.Result]
 Int.min                           : Int -> Int -> Int
 Int.min.doc                       : Doc
 Int.min.tests.associative         : [Test.Result]
 Int.min.tests.bottom              : [Test.Result]
 Int.min.tests.commutative         : [Test.Result]
 Int.min.tests.deMorgan            : [Test.Result]
 Int.min.tests.distributesOverMax  : [Test.Result]
 Int.min.tests.idempotent          : [Test.Result]
 Int.min.tests.partialOrder        : [Test.Result]
 Nat.max                           : Nat -> Nat -> Nat
 Nat.max.doc                       : Doc
 Nat.max.tests.absorption          : [Test.Result]
 Nat.max.tests.additionDistributes : [Test.Result]
 Nat.max.tests.associative         : [Test.Result]
 Nat.max.tests.commutative         : [Test.Result]
 Nat.max.tests.distributesOverMin  : [Test.Result]
 Nat.max.tests.idempotent          : [Test.Result]
 Nat.max.tests.identity            : [Test.Result]
 Nat.max.tests.partialOrder        : [Test.Result]
 ┌ Nat.max.tests.summation         : [Test.Result]
 └ Nat.min.tests.summation
 Nat.min                           : Nat -> Nat -> Nat
 Nat.min.doc                       : Doc
 Nat.min.tests.additionDistributes : [Test.Result]
 Nat.min.tests.associative         : [Test.Result]
 Nat.min.tests.commutative         : [Test.Result]
 Nat.min.tests.distributesOverMax  : [Test.Result]
 Nat.min.tests.idempotent          : [Test.Result]
 Nat.min.tests.identity            : [Test.Result]
 Nat.min.tests.partialOrder        : [Test.Result]
pchiusano commented 4 years ago

LGTM, merged in #7mrc1t233q