Skip to content

Consume prelude v7.3.1: share the unit singleton (@inline unit never) - #258

Merged
Unisay merged 3 commits into
mainfrom
issue-176/prelude-unit-inline-never
Jul 12, 2026
Merged

Consume prelude v7.3.1: share the unit singleton (@inline unit never)#258
Unisay merged 3 commits into
mainfrom
issue-176/prelude-unit-inline-never

Conversation

@Unisay

@Unisay Unisay commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Picks up prelude v7.3.1 via the package set (psc-0.15.15-20260712-2). The fork flips Data.Unit.unit from @inline unit always to never, which pins the unit = {} foreign singleton to one shared binding instead of letting the accessor fold into every use site. This is the compiler-side half of #176: the fork edit and release landed separately, and this PR just repoints the golden set and accepts the resulting churn.

What moves

  • test/ps/spago.yaml + test/ps/spago.lock: the set URL moves to psc-0.15.15-20260712-2, and prelude re-resolves to the v7.3.1 commit.
  • Ten golden.lua change shape: where always folded the accessor into each site, never keeps a single local Data_Unit_unit = Data_Unit_foreign.unit and references it by name:
 local Data_Unit_foreign = { unit = {} }
+local Data_Unit_unit = Data_Unit_foreign.unit
 ...
-return { main = Effect_applicativeEffect.pure(Data_Unit_foreign.unit) }
+return { main = Effect_applicativeEffect.pure(Data_Unit_unit) }
  • The remaining golden.ir churn is the prelude source path moving to the v7.3.1 commit.

Why it is safe

Refs #176

Unisay added 3 commits July 12, 2026 18:48
)

Dissolving the alias multiplied the Always target's use sites right
before Always pasted its body into every one of them, duplicating the
body (a lifted foreign's lambda, for example) across all alias use
sites. The top-level inliner now declines the bare-Ref tier when the
target carries @inline always, so the alias stays the single
materialization point and the body pastes into it once.

The top-level Always decision is also keyed by name (policyAlways)
rather than the RHS root annotation, so a binding that merely received
an always-annotated body during an earlier paste does not itself turn
unconditionally inlinable one fixpoint round later; the local rules
keep reading the root annotation.
The set release picks up prelude v7.3.1, which flips `@inline unit` from
`always` to `never` so the `unit = {}` foreign singleton is pinned to one
shared binding instead of being pasted per use site
(#176). Only the prelude fork moved in this
release.

Refs #176
With `@inline unit never`, the `Data_Unit_foreign.unit` accessor is no
longer folded into each use site; it becomes a single shared binding
(`local Data_Unit_unit = Data_Unit_foreign.unit`) that call sites
reference by name. Ten golden.lua move to this shape; the linked output
still holds exactly one `{}` for unit (the one inside the hoisted foreign
table), and every eval/golden.txt oracle is byte-identical, so runtime
behaviour is unchanged. The remaining golden.ir churn is the prelude
source path moving to the v7.3.1 commit.

Refs #176
@Unisay
Unisay merged commit 1c5d82c into main Jul 12, 2026
2 checks passed
@Unisay
Unisay deleted the issue-176/prelude-unit-inline-never branch July 12, 2026 19:34
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