Created
November 19, 2013 19:58
-
-
Save JasonGross/7551528 to your computer and use it in GitHub Desktop.
Bad ocaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let gen_const_list ~is_done:(is_done : 'n -> bool) ~pred:(pred : 'n -> 'n) | |
| (size : 'n) (v : 'a) : 'a list = | |
| let rec helper size v = | |
| if is_done size then [] else v::(helper (pred size) v) | |
| in helper size v | |
| let const_list : int -> 'a -> 'a list = | |
| gen_const_list ~is_done:(fun size -> size <= 0) ~pred:(fun n -> n - 1) | |
| module Stupid = struct | |
| type t = X | Y | |
| let x (sz : int) : t list = const_list sz X | |
| end;; | |
| (** Error: This expression has type t but an expression was expected of type 'a | |
| The type constructor t would escape its scope *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment