summaryrefslogtreecommitdiff
path: root/libstd/extremum.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-10-21 17:17:12 -0400
committerOri Bernstein <ori@eigenstate.org>2012-10-21 17:17:12 -0400
commita3f00eee7003eae5aaf6c91fd674915e098b8b18 (patch)
treebf0c97fa0ed0f10262a2b915706445f87704f0a2 /libstd/extremum.myr
parent90ed95ded198b9c57dfb6bf172cfd975da73e66f (diff)
downloadmc-a3f00eee7003eae5aaf6c91fd674915e098b8b18.tar.gz
Don't specialize generics into other generics.
Diffstat (limited to 'libstd/extremum.myr')
-rw-r--r--libstd/extremum.myr20
1 files changed, 20 insertions, 0 deletions
diff --git a/libstd/extremum.myr b/libstd/extremum.myr
new file mode 100644
index 0000000..5d63acd
--- /dev/null
+++ b/libstd/extremum.myr
@@ -0,0 +1,20 @@
+pkg std =
+ generic min : (a : @a::tcnum, b : @a::tcnum -> @a::tcnum)
+ generic max : (a : @a::tcnum, b : @a::tcnum -> @a::tcnum)
+;;
+
+generic min = {a, b
+ if a < b
+ -> a
+ else
+ -> b
+ ;;
+}
+
+generic max = {a, b
+ if a > b
+ -> a
+ else
+ -> b
+ ;;
+}