summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2014-06-29 08:33:47 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2014-06-29 08:33:47 -0400
commit26fde08de43211e6b4e8e6c1f02173629232b0ac (patch)
tree218238598a48fdb5d119334cb56573363d27ea46 /lib/ur
parentabb214d29dd8088b5dad7b61aefb7db24fa787ac (diff)
Top.max and Top.min
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/top.ur5
-rw-r--r--lib/ur/top.urs3
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 5b9d43ab..3250a5a3 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -405,3 +405,8 @@ fun postFields pb =
"application/x-www-form-urlencoded" => postFields' (postData pb)
| _ => error <xml>Tried to get POST fields, but MIME type is not "application/x-www-form-urlencoded"</xml>
end
+
+fun max [t] ( _ : ord t) (x : t) (y : t) : t =
+ if x > y then x else y
+fun min [t] ( _ : ord t) (x : t) (y : t) : t =
+ if x < y then x else y
diff --git a/lib/ur/top.urs b/lib/ur/top.urs
index 2ea86dc4..15bc6a22 100644
--- a/lib/ur/top.urs
+++ b/lib/ur/top.urs
@@ -287,3 +287,6 @@ val eqNullable' : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
val mkRead' : t ::: Type -> (string -> option t) -> string -> read t
val postFields : postBody -> list (string * string)
+
+val max : t ::: Type -> ord t -> t -> t -> t
+val min : t ::: Type -> ord t -> t -> t -> t