Add tutorial: Reading OCaml Errors#3583
Open
cuihtlauac wants to merge 2 commits into
Open
Conversation
New guide teaching a systematic method for reading OCaml compiler errors, covering: - Anatomy of an error message (location, tag, body, sub-messages) - Rule 1: fix the first error, rebuild (later errors cascade) - Type mismatches: reading "has type X" vs "expected Y", deciding which side is wrong - Unbound identifiers: value, module, type, record field — and when "Unbound module" means a dune config issue, not a code error - Function application errors: not-a-function, too many args, labels - Pattern matching: exhaustiveness, unused cases - Record/constructor errors: missing fields, shadowed types, mutability - Module errors: signature mismatch, structure/functor confusion - Key warnings table (8, 11, 16, 20, 26, 27, 32) and -warn-error - Step-by-step method for approaching any unfamiliar error Error examples verified against OCaml 5.x compiler output. Also adds "reading-errors" as prerequisite to common-errors tutorial. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- MD040: Add `text` language tag to bare code blocks showing compiler error output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data/tutorials/guides/rs_03_reading_errors.md(~270 lines)(libraries ...)in dune, not a code error-warn-errorexplanationBased on analysis of the OCaml compiler's error reporting infrastructure (
typing/typecore.ml,typing/env.ml,typing/typemod.ml,utils/warnings.ml).Test plan
make buildsucceeds/docs/reading-errors/docs/common-errorsworks🤖 Generated with Claude Code