OCaml From the Ground Up
This is a work in progress introductory book on the OCaml programming language.
Contributing
The git repo is at github.com/dmbaturin/ocaml-book.
What sets this book apart is that it’s under CC-BY-SA, a free, strong copyleft license similar to the GNU GPL in spirit.
It belongs to the community and everyone can freely distribute and modify it. Even if the original authors no longer have time to maintain it, the community can keep it up to date and distribute updated versions.
Right now the book is obviously incomplete, but together we can complete it faster than I can do it alone. Every contribution counts! Beta reading and editing are important. If you want to write a whole chapter, that’s even better.
Just like with free software, the copyright stays shared between all contributors.
Principles behind the book
- Build it bottom up, never introduce a concept before it can be fully explained.
- Stick with the standard library.
- When third-party libraries are used, mention it prominently and use fully qualified names.
- Don’t make it REPL-centric.
- Do not mention foxes or chunky bacon.
Chapters to be written
If you want to help writing any of those, you are welcome!
- Strings and buffers
-
Immutable strings vs mutables
bytes
. Operations on strings. Operations on buffers. - Polymorphic variants
- Polymorphic variants as a fallback to dynamic typing. Subtyping. Open types.
- Introduction to modules
-
Defining modules.
open
,let open ... in
, andmodule M = ...
. - Module signatures
- Module types. Signature ascription. Abstract types and information hiding.
- Functors
- Input and output
- File descriptor types. Input/output operations.