Merged
Conversation
…'s `Bind` Adds `bind_flipped`, `join`, `compose_kleisli`, and `compose_kleisli_flipped` as free functions on `Semimonad`, and `if_m` on `Monad` (which requires `pure` via `Applicative`). if_m uses a `Clone` bound on branches to support multi-element monads like `Vec`.
Implement a proc macro that desugars Haskell/PureScript-style do-notation into nested `bind` calls, eliminating rightward drift in monadic code. Supported statement forms: - `x <- expr;` — monadic bind - `x: Type <- expr;` — bind with type annotation - `_ <- expr;` / `expr;` — sequence (discard result) - `let x = expr;` / `let x: Type = expr;` — pure let binding - `pure(expr)` — auto-rewritten to `pure::<Brand, _>(expr)` Also reorganize feature lists in lib.rs and README.md for clarity, and add consistent `// Invocation` / `// Expanded code` examples to all `document_*` macro doc comments.
- Add Alt, Plus, and Alternative type class definitions in classes/ - Implement Alt and Plus for Option, Vec, and CatList (Alternative follows via blanket impl for Applicative + Plus) - Re-export plus_empty in functions.rs - Add ### Laws sections with law-checking doc examples to: Compactable (identity + conditional laws with Plus), Filterable (distributivity, identity, composition, consistency), Witherable (identity, multipass filter/partition) - Add law-checking doc examples to traits that had law statements but no code examples: Applicative, Bifunctor, Category, Contravariant, Monoid, Semigroup, Semigroupoid, Semiapplicative - Expand Monad module docs with m! macro examples (Option, Vec, Result) and add monad law examples (left/right identity, associativity) for Option and Vec - Add Vec law examples to Functor - Fix Profunctor composition law: g argument order was reversed - Update docs/todo.md
Add PureScript-style type class hierarchy for numeric types: Semiring, Ring, CommutativeRing, EuclideanRing, DivisionRing, Field, and HeytingAlgebra, with instances for all Rust numeric primitives and bool. Integer instances use wrapping arithmetic for consistent debug/release behavior. Add 7 newtype wrappers with Semigroup/Monoid instances: Additive, Multiplicative, Conjunctive, Disjunctive, First, Last, and Dual. Move integration tests from tests/property_tests/ into inline #[cfg(test)] modules and extend document_examples proc macro to handle #[doc = concat!()] attributes.
Add trait-level `#[document_examples]` with law assertions to seven traits, following PureScript's purescript-foldable-traversable as the reference for which laws to document: - Foldable: fold_map/fold_right internal consistency - Traversable: traverse/sequence consistency (both directions) - FunctorWithIndex: identity and Functor compatibility - FoldableWithIndex: Foldable compatibility - TraversableWithIndex: Traversable compatibility - Bifoldable: bi_fold_map/bi_fold_right consistency - Bitraversable: bi_traverse/bi_sequence consistency via bimap
Rename `greatest_common_divisor` → `gcd` and `least_common_multiple` → `lcm` in euclidean_ring for brevity. Add missing derived combinators ported from PureScript's prelude: - `power` (monoid): binary exponentiation via repeated `append` - `when`/`unless` (applicative): conditional actions on plain `bool` - `when_m`/`unless_m` (monad): conditional actions on monadic `bool` - `on` (functions): apply binary function after projecting both args - `lift3`/`lift4`/`lift5` (lift): higher-arity lifting via nested `lift2` Fix 15 broken rustdoc links in newtype wrapper module docs by qualifying trait references with full `crate::classes::` paths.
Implement PureScript-style applicative do-notation that desugars into `pure`/`map`/`lift2`–`lift5` depending on the number of bindings. Unlike `m!`, bindings are independent — later bind expressions cannot reference earlier bound variables. - 0 binds → `pure`, 1 → `map`, 2–5 → `liftN` - `let` bindings before any `<-` are hoisted outside the combinator - `let` bindings after a `<-` go inside the combining closure - `pure(...)` in bind expressions is auto-rewritten with the brand - Reuse `DoInput` parser and `rewrite_pure` from `m!` implementation - Update applicative module docs to showcase `ado!` - Reorder CLAUDE.md verification steps to fmt → clippy → doc → test
Equal-length snake_case names encourage `a_do!` (applicative, preferred) over `m_do!` (monadic) and align with the library's naming conventions. Renames modules `do_notation` → `m_do`, `ado_notation` → `a_do`, and updates all doc comments, tests, and examples across the workspace.
…creation Move change review and version bump steps before branch creation so the version number is known when naming the branch. Split changelog work into recording changes under [Unreleased] during review and finalizing the section header after versioning.
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.
No description provided.