Skip to content

Extend the default directive pack to foldable-traversable and enums #331

Description

@Unisay

Problem

The default directive pack (#242) covers the prelude fork plus the generics glue and the ST/Ref modify wrappers. The corpus still shows dictionary-parameterized residuals from other core forks: Data.Foldable.foldableArray field reads and the Data.String.CodePoints enum machinery (boundedEnumCodePoint.toEnum/fromEnum) survive in several goldens. The Foldable/Traversable member accessors (foldl, foldr, foldMap, traverse, sequence) and the Data.Enum combinators are exactly the accessor shape the pack force-inlines for the prelude classes, so folds and traversals over concrete structures stop specializing one library short of the prelude's treatment.

Approach

Extend the pack entry-by-entry with the same empirical loop that calibrated #242 in PR #327: add a candidate entry, regenerate the structural goldens, keep the entry only if the corpus shrinks or holds everywhere and every eval golden stays byte-identical, drop it on any regression. Candidates in leaning order: the Foldable/Traversable member accessors at arity=1, then Data.Enum's accessors and small combinators. Where corpus coverage is thin, add a focused golden first (the Golden.DirectivePack module is the template).

Prerequisites / Relations

Follow-up to #242 / PR #327. Ideally after #330 (the monotone pack tier), which removes the risk that an accessor entry pessimizes sites the heuristics currently win — the calibration in #327 had to drop entries for exactly that reason.

Verification / Measurement

Per accepted entry: corpus golden.lua total does not grow, at least one golden demonstrably improves, eval goldens unchanged; the headline delta reported through the bench harness (#172).

Metadata

Metadata

Assignees

No one assigned

    Labels

    OptimisationA Compiler Optimisationarea: irIR / optimizer / DCE / inlinerenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions