summaryrefslogtreecommitdiff
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
commit778529d825a22a4ae0ffed046b87b6ad4ee1c496 (patch)
tree218238598a48fdb5d119334cb56573363d27ea46
parent1d498314f0fc9e941d2a10f07c86f6f8ca9ac180 (diff)
Top.max and Top.min
-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