-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Hello Eio team,
I've been re-using the pattern from Eio.Resource in the provider project. Recently, I've spent some time trying to make the use of Obj.magic more robust in provider. You can see some of the discussions and efforts here.
During this process, I've encountered cases of invalid uses that lead to unfortunate results. I'm sharing one such case that is also applicable to Resource:
type ('a, 'impl, 'tag) Eio.Resource.pi += Trait : (unit, 'a, [ `A ]) Eio.Resource.pi
let a = (Trait : (unit, string, [ `A ]) Eio.Resource.pi)
let h = Eio.Resource.handler [ H (a, "hello") ]
let b = (Trait : (unit, int, [ `A ]) Eio.Resource.pi)
let%expect_test "crash" =
let (i : int) = Eio.Resource.get h b in
print_s [%sexp { is_int = (Obj.is_int (Obj.repr i) : bool) }];
[%expect {| ((is_int false)) |}];
()
;;I'm not sure if it is possible to address this issue. I'd be interested in discussions with the Eio team on this.
Thank you for your time and for Eio!
Metadata
Metadata
Assignees
Labels
No labels