Skip to content

README discussion of type 'a env convention is out of date #613

@jonsterling

Description

@jonsterling

I am trying to update my project to handle the new API changes (replacing objects with first class modules and variants), and I am having a little trouble understanding how to adapt the type 'a env convention described in the README, which is now outdated. I'm filing this ticket to put the README issue on your radar, but maybe this is also a good opportunity for me to learn how to use this properly.

The issue is that the release notes for 0.12 say that we can replace #foo with _ foo, but this does not work in type declarations. I ended up getting very confused about what it is I should put there, because I have to admit that I am not fully comfortable yet with OCaml's variants and how to control them, vis-a-vis subtyping, etc. What I ended up change my code to (which type-checked) was the following:

type 'a env = <
  cwd : Eio.Fs.dir_ty Eio.Path.t;
  process_mgr : [>] Eio.Process.mgr;
  stdout : [>] Eio.Flow.sink;
  ..
> as 'a

Is this what you intend, or is there a better way to write this? I didn't actually know what [>] means. If this is the right way to write this code, then I can update the Eio README in a PR. thanks for your help and patience!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions