Skip to content

Conversation

johnwhitington
Copy link
Contributor

Hello!

This pull request adds an introductory example to YoJSON. This is part of a pilot programme funded by the OCaml Software Foundation.

Many OCaml libraries have no examples, or perfunctory examples only. This makes it difficult to get started with a library, particularly if it has an elaborate interface. A working example, no matter how small, can help a newcomer get started quickly. One day, it would be nice to have an example for every Opam package.

For now, examples begin in the OCaml Nursery, here: https://github.com/johnwhitington/ocaml-nursery (you can read in the README there about the principles behind these examples.) Then, if package authors agree, they are promoted to upstream source. The hope is that this will mean they are more likely to be kept up to date with the library.

The examples are usually, included in a separate directory, within a separate Dune workspace. And so they are intended to be used after installation of the library. However, in this case, I have followed the pattern of the existing examples.

As well as considering accepting this pull request, please do give any comments you have on this programme.

Copy link
Member

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the examples, that's nice and I'll gladly include them once ready. I appreciate the way that they are in line with the rest of the code as I would not want to install public executables onto users systems.

What would be nice is also examples in the documentation using odoc. That way users would see the examples on ocaml.org in the documentation, which is probably more approachable than the source repository.

@johnwhitington
Copy link
Contributor Author

Thanks. I've fixed the issues.

You idea about examples in the documentation sounds good too for the future.

@Leonidas-from-XIV Leonidas-from-XIV added the no changelog Not a user visible change, does not require changelog entry label Jun 16, 2025
@Leonidas-from-XIV
Copy link
Member

Cool. Can you fix the remaining CI failures? It seems like it's only missing reformatting.

@Leonidas-from-XIV
Copy link
Member

Can you fix the remaining formatting failures? I tried pushing the fixes to your branch directly, but don't have permission to do so.

@johnwhitington
Copy link
Contributor Author

The commit I pushed a couple of hours ago 4165aca is still waiting for CI to report. I'm hoping the fact I used a more modern version of ocamlformat than your .ocamlformat suggests is ok. But we'll see when the CI reports...

@Leonidas-from-XIV
Copy link
Member

The formatting linter has already finished and while the ocamlformat version hasn't been a problem, the dune file is misformatted, hence my failed attempt to push a fix directly instead of pestering contributors with minutia ;-)

The easiest way to get everything formatted correctly is just calling dune fmt, which should be reformatting everything that should be reformatted.

@Leonidas-from-XIV Leonidas-from-XIV merged commit 273c11a into ocaml-community:master Jun 17, 2025
3 checks passed
@Leonidas-from-XIV
Copy link
Member

Merged. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog Not a user visible change, does not require changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants