Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eio: stdenv type not compatiable with Eio_unix.Stdenv #114

Closed
ada2k opened this issue Feb 17, 2024 · 6 comments
Closed

Eio: stdenv type not compatiable with Eio_unix.Stdenv #114

ada2k opened this issue Feb 17, 2024 · 6 comments

Comments

@ada2k
Copy link

ada2k commented Feb 17, 2024

Hi,
The ~stdenv argument taken by caqti-eio does not appear to be compatible with Eio_unix.Stdenv. If I manually create an object with the net, clock and mono_clock methods copied from Eio_unix.Stdenv, it then throws a type error expecting [Generic] instead of [Generic | Unix]. Editing system.ml to accept [ Generic | `Unix ] allows me to connect to a postgres instance fine. I have caqti pinned to master with eio 0.14, not tested on release.
Thank you

@paurkedal
Copy link
Owner

I assume you are seeing a compile-time error related to the net component of the environment containing additional `Unix functionality. In general if you have an environment which is richer than needed, you can restrict it with (myenv :> Caqti_eio.stdenv) before passing it, which should also work here.

@ada2k
Copy link
Author

ada2k commented Feb 21, 2024

Thank you! I'm not too familiar with classes, so sorry for wasting your time.

@ada2k ada2k closed this as completed Feb 21, 2024
@paurkedal
Copy link
Owner

No problem; it's one of the lesser known parts of the language. Maybe the preferred way would have been to pass the three resources individually, though I think the current approach of bundling them provides a better chance of programs being compatible with new versions of Caqti which might require extra resources from the stdenv.

@ada2k ada2k reopened this Feb 24, 2024
@ada2k ada2k closed this as completed Feb 24, 2024
@ada2k
Copy link
Author

ada2k commented Feb 24, 2024

I know caqti-eio is prerelease, but would it's API be stable enough to receive some documentation? I would be happy to translate the bikereg example from Lwt. I think Eio can present unfamiliar elements to more people than me (especially with it's use of the class system), so a simple 1-1 demonstration of an lwt program would be useful.

@paurkedal
Copy link
Owner

Yes, I realized some documentation is needed here. I will add some basics to the API doc. The caqti-study is maybe a better place for examples. I have considered moving the bikereg there, as well. We should coordinate that with @benjamin-thomas who has done most of the current work there.

@benjamin-thomas
Copy link

Sounds good to me 👍

I've opened an issue to track this. We can discuss there if you feel like giving a hand @ada2k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants