Commit 92096b76 authored by Tim Steenvoorden's avatar Tim Steenvoorden
Browse files

Redesign Ordering with Int

parent d9552c87
......@@ -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 | Greater
/// # Helpers
compare :: !a !a -> Ordering | Ord a
comparing :: !(b -> a) b b -> Ordering | Ord a
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment