Skip to content

Instantly share code, notes, and snippets.

@andreas
Created July 31, 2017 11:20
Show Gist options
  • Save andreas/53f67474cbc69e8b995229042c07b956 to your computer and use it in GitHub Desktop.
Save andreas/53f67474cbc69e8b995229042c07b956 to your computer and use it in GitHub Desktop.
type (_, _) typ =
(* ... other definitions *)
| DynTyp : 'ctx dyn -> ('ctx, 'ctx dyn) typ
and 'ctx dyn =
Dyn : ('ctx, 'src) typ * 'src -> 'ctx dyn
let rec typ_to_string : type src. ('ctx, src) typ -> 'ctx -> src -> string =
fun typ ctx src ->
match typ with
(* ... other match cases *)
| DynTyp (Dyn (typ', src')) -> typ_to_string typ' ctx src'
Error: This pattern matches values of type ($'ctx, $'ctx dyn) typ
The type constructor $'ctx would escape its scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment