Skip to content

Commit

Permalink
add string order2
Browse files Browse the repository at this point in the history
  • Loading branch information
TimWhiting committed Sep 22, 2024
1 parent 9755c5f commit 9f74376
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions std/core-extras.kk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import std/core/undiv
extern import
c file "inline/core-extras"

// String ordering
pub inline fun str/order2( ^x : string, ^y : string ) : order2<string>
if x < y then Lt2(x,y)
elif x == y then Eq2(x)
else Gt2(y,x)

// Order two `:maybe` values in ascending order
pub fip fun eff/order2( mb1 : maybe<a>, mb2 : maybe<a>, ^?order2 : (a,a) -> e order2<a> ) : e order2<maybe<a>>
match mb1
Expand Down

0 comments on commit 9f74376

Please sign in to comment.