Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tim Steenvoorden
clean-base
Commits
92096b76
Commit
92096b76
authored
Feb 18, 2016
by
Tim Steenvoorden
Browse files
Redesign Ordering with Int
parent
d9552c87
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Algebra/Order.dcl
View file @
92096b76
...
...
@@ -9,6 +9,12 @@ class Eq a where
/// # Order
::
Ordering
(:==
Int
)
Lesser
::
Ordering
Equal
::
Ordering
Greater
::
Ordering
class
Ord
a
|
Eq
a
where
(<)
infix
4
::
!
a
!
a
->
Bool
//TODO generic
...
...
@@ -19,9 +25,8 @@ class Ord a | Eq a where
min
::
!
a
!
a
->
a
|
Ord
a
max
::
!
a
!
a
->
a
|
Ord
a
/// # Helpers
compare
::
!
a
!
a
->
Ordering
|
Ord
a
::
Ordering
=
Lesser
|
Equal
|
Great
er
/// # Help
er
s
compare
::
!
a
!
a
->
Ordering
|
Ord
a
comparing
::
!(
b
->
a
)
b
b
->
Ordering
|
Ord
a
src/Algebra/Order.icl
View file @
92096b76
...
...
@@ -2,6 +2,17 @@ implementation module Algebra.Order
import
Data
.
Bool
::
Ordering
:==
Int
Lesser
::
Ordering
Lesser
=
-1
Equal
::
Ordering
Equal
=
0
Greater
::
Ordering
Greater
=
+1
/// # Equivalence
(/=)
infix
4
::
!
a
!
a
->
Bool
|
Eq
a
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment