reasonml / reason

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
http://reasonml.github.io
MIT License
10.09k stars 424 forks source link

GADT code in OCaml #2642

Open EduardoRFS opened 3 years ago

EduardoRFS commented 3 years ago

In OCaml this two pieces of code are different

let cdr = fun (Cdr, ((_, b), rest)) -> (b, rest)
let cdr (Cdr, ((_, b), rest)) = (b, rest)

The first one when you're working with GADTs say that the pattern matching is not exhaustive, the second one doesn't, but there is no good way to represent the second one in Reason