Skip to content

Land Data.Monoid and Data.Foldable - #135

Merged
biuld merged 6 commits into
masterfrom
feat/ph3-data-foldable
Oct 4, 2026
Merged

biuld merged 6 commits into
masterfrom
feat/ph3-data-foldable

Conversation

@biuld

@biuld biuld commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Add Data.Monoid (mempty for String, Unit, and Array a) and Data.Foldable
(foldr, foldl, and foldMap, with Array, Maybe, and Either a instances).
foldMap's type is constrained by Monoid, so the two classes are one slice:
on 6f66524 they are the highest compile-path Data blockers #124 owns and
#96 does not. The Array instance walks arrayLength and arrayIndex. fold is
omitted, because foldMap of the identity under a quantified Foldable f
projects a rank-2 method from a dictionary parameter and fails CC
verification, which rejects every program that does not prune the library.

Measured on 6f66524 by the compile-path scoreboard classification: missing
library 57 -> 55, P3 107 -> 109, lenient passing resolution unchanged at
245/413, P10 172, P5 typecheck 40, P5 kind check 17, P8 12, P6 4, P0 4.
Data.Foldable was 4 and Data.Monoid 3; five of those seven files stop on a
later missing module and two stop at another P3 error.

Wasmtime 48.0.0 executes the monoid identities and the Array, Maybe, Either,
and user-instance folds. purs 0.15.16.

biuld and others added 6 commits October 4, 2026 06:41
Add stdlib/lib/Data/Show.purs: the Show class, its show method, and the
Boolean, Int, Number, Char, String, Unit, and Array a instances. Prelude
re-exports the class and method, and stdlib/lib/trusted loads the module
after Data.Semiring.

Number rendering is library code over the numeric primitives, not a new
intrinsic and not a correctly rounded ECMAScript conversion. Records,
Maybe, Either, and Tuple stay out: records need reflectSymbol, and the
other modules belong to later slices. logShow and assertEqual stay with
#95.

On this master, L2 passing resolution moves from 245/413 to 253/413 and
other P3 blockers from 107 to 99. show and Show are no longer first-blocker
names. D-04 and D-15 record the measurement.
Add Data.Monoid (mempty for String, Unit, and Array a) and Data.Foldable
(foldr, foldl, and foldMap, with Array, Maybe, and Either a instances).
foldMap's type is constrained by Monoid, so the two classes are one slice:
on 6f66524 they are the highest compile-path Data blockers #124 owns and
#96 does not. The Array instance walks arrayLength and arrayIndex. fold is
omitted, because foldMap of the identity under a quantified Foldable f
projects a rank-2 method from a dictionary parameter and fails CC
verification, which rejects every program that does not prune the library.

Measured on 6f66524 by the compile-path scoreboard classification: missing
library 57 -> 55, P3 107 -> 109, lenient passing resolution unchanged at
245/413, P10 172, P5 typecheck 40, P5 kind check 17, P8 12, P6 4, P0 4.
Data.Foldable was 4 and Data.Monoid 3; five of those seven files stop on a
later missing module and two stop at another P3 error.

Wasmtime 48.0.0 executes the monoid identities and the Array, Maybe, Either,
and user-instance folds. purs 0.15.16.
cargo fmt orders the test module declarations alphabetically, so
`mod foldable` belongs after `mod effects` and before `mod guard_coverage`.
Keep both Data.Show and Data.Foldable. The D-04 scoreboard figures were
measured independently on 6f66524 and are not additive.
The module is in stdlib/lib/trusted, so the order assertion has to name
it or loads_the_standard_library_from_disk_in_trusted_order fails.
Take the trusted-order loader assertion that names Data.Show.
@biuld
biuld merged commit d22e811 into master Oct 4, 2026
2 checks passed
@biuld
biuld deleted the feat/ph3-data-foldable branch October 4, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant