Created
July 1, 2021 21:50
-
-
Save Octachron/5e5cd4d5d72435d5c3a28224fdfeffc6 to your computer and use it in GitHub Desktop.
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
type 'a s = private Succ | |
type ('elt,'size) t = | |
| [] : ('elt, 'a -> 'a) t | |
| (::): 'elt * ('elt, 'z -> 'k) t -> ('elt, 'z -> 'k s) t | |
let rec (@): type elt low mid high. | |
(elt, mid -> high) t -> (elt, low -> mid) t -> (elt, low -> high) t = | |
fun l r -> | |
match l with | |
| [] -> r | |
| a :: q -> a :: (q @ r) | |
let wrong x y = | |
x @ y, x @ 1 :: y | |
let lit = [1;2] | |
let ok = lit @ [1], lit @ lit | |
let lookalike = [1] @ [2] | |
let wrong_2 = lookalike @ [1], lookalike @ lookalike |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment