summaryrefslogtreecommitdiff
path: root/src/util.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-11-16 15:05:24 +0000
committerAlasdair Armstrong2017-11-16 15:05:24 +0000
commit9a5bd2079a5fe42bde4c207851c2c3b1fd0035b7 (patch)
treeb1738446b771e6bfe2d0de64d4c56b2c9c592e81 /src/util.ml
parent17488b1fdd35983f41c80282997c0ab820c9a23d (diff)
Fixed some longstanding issues regarding constraints on type constructors.
Now constraints on type constructors are checked correctly when checking that types are well formed using Env.wf_typ. The arity and kind of type constructor arguments are also checked in the same way. Also some general cleanups to the type checker code, with some auxillary functions being moved to more appropriate files.
Diffstat (limited to 'src/util.ml')
-rw-r--r--src/util.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util.ml b/src/util.ml
index 762e0f88..4f7878c7 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -365,3 +365,8 @@ let is_some = function
| None -> false
let is_none opt = not (is_some opt)
+
+let rec take n xs = match n, xs with
+ | 0, _ -> []
+ | n, [] -> []
+ | n, (x :: xs) -> x :: take (n - 1) xs