-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09c0bb7
commit 9534bd2
Showing
3 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Stdlib.Data.Ordering; | ||
|
||
import Stdlib.Trait.Eq open; | ||
import Stdlib.Data.Bool.Base open; | ||
import Stdlib.Trait.Show open; | ||
|
||
builtin ordering | ||
type Ordering := | ||
| LessThan | ||
| Equal | ||
| GreaterThan; | ||
|
||
isLessThan (ordering : Ordering) : Bool := | ||
case ordering of | ||
| LessThan := true | ||
| _ := false; | ||
|
||
isEqual (ordering : Ordering) : Bool := | ||
case ordering of | ||
| Equal := true | ||
| _ := false; | ||
|
||
isGreaterThan (ordering : Ordering) : Bool := | ||
case ordering of | ||
| GreaterThan := true | ||
| _ := false; | ||
|
||
deriving instance | ||
orderingEqI : Eq Ordering; | ||
|
||
instance | ||
orderingShowI : Show Ordering := | ||
mkShow@{ | ||
show : Ordering -> String | ||
| Equal := "Equal" | ||
| LessThan := "LessThan" | ||
| GreaterThan := "GreaterThan"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Stdlib.Trait.Show; | ||
|
||
import Stdlib.Data.String.Base open; | ||
import Juvix.Builtin.V1.String open public; | ||
|
||
trait | ||
type Show A := mkShow@{show : A -> String}; |