Hello caml-list,
when I try to run the following code:
type sometype =
([
`Foo of int
| `Bar of int
| `Var of 'a ref
] as 'a)
type someother =
([
`Foo of int
| `Var of 'a ref
] as 'a)
let foo : someother = `Foo 5;;
(foo :> sometype)
in my ocaml repl, it gives me the following error
This expression cannot be coerced to type
sometype = [ `Bar of int | `Foo of int | `Var of sometype ref ];
it has type someother = [ `Foo of int | `Var of someother ref ]
but is here used with type
[< sometype ] = [< `Foo of int | `Var of sometype ref ]
Type someother = [ `Foo of int | `Var of someother ref ]
is not compatible with type
sometype = [ `Bar of int | `Foo of int | `Var of sometype ref ]
The first variant type does not allow tag(s) `Bar
how do I get around this?