Add Option/Result combinators (#211)#292
Merged
Merged
Conversation
Ship 5 combinator functions (option_unwrap_or, option_map, option_and_then, result_unwrap_or, result_map) that eliminate 5-line match blocks for every fallible operation. Implementation: define as Vera source, inject into program AST via prelude, compile through existing monomorphization pipeline. Key compiler fixes for generic closures: - Monomorphizer infers type variables from AnonFn arguments - WASM call rewriter handles AnonFn against type alias FnType params - Generic type alias return type inference with substitution - Closure signature deduplication across functions Also renames map_option → option_map per #288 naming convention. Closes #211 Co-Authored-By: Claude <noreply@anthropic.invalid>
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
option_unwrap_or,option_map,option_and_then,result_unwrap_or,result_mapmap_optiontooption_mapacross entire codebase per Built-in function naming consistency audit #288 naming conventionCloses #211
Test plan
pytest tests/ -v)mypy vera/)check_conformance.py)check_examples.py)Generated with Claude Code