Last active
February 27, 2023 21:49
-
-
Save mheiber/798e1c8b1bda11a748e61ed167d9d08a to your computer and use it in GitHub Desktop.
vector ocaml dependent vector
This file contains 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 zero = unit * unit | |
type 'a minus1 = 'snd constraint 'a = unit * 'snd | |
type 'a plus1 = unit * 'a | |
type _ lst = | |
| [] : zero lst | |
| ( :: ) : int * 'b lst -> ('b lst) plus1 lst | |
let cons n lst = n :: lst | |
let hd = function | |
| h :: _ -> h | |
let tl = function | |
| _ :: t -> t | |
let l0 = [] | |
let l1 = 1 :: l0 | |
let l2 = 2 :: l1 | |
let l1' = tl l2 | |
let l0' = tl l1 | |
let _ = tl l0' (* error *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment