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

Imperative Programming - IO - Improve example #3672

Open
felix-alonso opened this issue Aug 29, 2023 · 0 comments
Open

Imperative Programming - IO - Improve example #3672

felix-alonso opened this issue Aug 29, 2023 · 0 comments

Comments

@felix-alonso
Copy link

In the chapter on Imperative Programming under the Terminal IO section, there is an example that allows you to find the time in a particular time zone. The functionality is in the core_unix.time_unix library. The example tells you make a Dune file like you do in Chapter 4:

We can build this program using dune and run it, though you’ll need to add a dune-project and dune file, as described in Chapter 4, Files Modules and Programs.

However, Chapter 4 doesn't mention the relationship between packages and libraries or the syntax for adding a specific library in a package to a Dune file.

This is somewhat complicated by the fact that there were deprecations to the Core libraries. If you try to use Core.Time.Zone then you'll just get an error telling you to use Time_unix.

If we added a copy of the dune file, it would make the section more clear and it might expose people to the idea that there are nested scopes in packages.

Here is my dune file:

(executable
  (name time_converter)
  (libraries base core core_unix.time_unix stdio))

If the authors are amenable to this, I could open up a PR.

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

1 participant