Skip to content

feat: add console grouping (group, groupCollapsed, groupEnd, grouped) - #7

Merged
Unisay merged 1 commit into
masterfrom
yura/issue-268-fork-ffi-console-group-groupcollapsed
Jul 14, 2026
Merged

feat: add console grouping (group, groupCollapsed, groupEnd, grouped)#7
Unisay merged 1 commit into
masterfrom
yura/issue-268-fork-ffi-console-group-groupcollapsed

Conversation

@Unisay

Copy link
Copy Markdown
Collaborator

Closespurescript-lua/purescript-lua#268.

Upstream purescript-console v6.1.0 exports group, groupCollapsed and groupEnd; the fork had none of them, so code written against the registry package failed to compile against the fork.

A terminal has no collapsible groups, so the Lua FFI approximates the JS semantics with an indentation level: group/groupCollapsed print their label and indent subsequent console output by two spaces per open group; groupEnd closes the innermost group and is a no-op at level zero. grouped and the MonadEffect versions in Effect.Class.Console mirror upstream verbatim, and the inherited upstream Console.js gains the same exports so it keeps matching its upstream counterpart.

The regression guard (test/regression/console.lua) pins the chosen output behaviour: label printed at the current indent, two spaces per open group on stdout and stderr alike, groupCollapsed = group, and groupEnd without an open group staying a no-op. The whole path is verified: spago build and the pslua link succeed, and the linked module prints the expected indented output.

Follow-up (not in this PR): console fork patch release, then a package-set bump.

Upstream purescript-console v6.1.0 exports group, groupCollapsed and
groupEnd; the fork had none of them, so code written against the registry
package failed to compile against the fork.
A terminal has no collapsible groups, so the Lua FFI approximates the JS
semantics with an indentation level: group/groupCollapsed print their
label and indent subsequent console output by two spaces per open group;
groupEnd closes the innermost group and is a no-op at level zero. grouped
and the MonadEffect versions in Effect.Class.Console mirror upstream
verbatim, and the inherited upstream Console.js gains the same exports to
stay a faithful mirror.
Extends the regression guard to pin the chosen output behaviour.
Closespurescript-lua/purescript-lua#268
@Unisay
Unisay requested a review from CopilotJuly 13, 2026 17:08
@UnisayUnisay self-assigned this Jul 13, 2026
@Unisay
Unisay marked this pull request as ready for review July 13, 2026 17:10

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing console grouping APIs to this PureScript→Lua fork to match upstream purescript-console v6.1.0, preventing downstream code (written against the registry package) from failing to compile. Since terminals don’t support collapsible console groups, the Lua FFI implements grouping via a shared indentation level across console output.

Changes:

  • Add group, groupCollapsed, groupEnd, and grouped to Effect.Console and Effect.Class.Console.
  • Implement Lua-side grouping via indentation and update all console outputs (stdout/stderr) to respect the current indentation level.
  • Add a regression test covering grouping semantics and document the change via a changelog fragment.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
test/regression/console.luaAdds regression coverage for grouping output/indent behavior (stdout + stderr) and groupEnd at level 0 being a no-op.
src/Effect/Console.pursExposes new foreign imports (group*) and adds grouped helper in Effect.
src/Effect/Console.luaImplements grouping via indentation and applies indentation consistently to log/warn/error/info/debug.
src/Effect/Console.jsAdds upstream-parity JS exports for group, groupCollapsed, groupEnd.
src/Effect/Class/Console.pursAdds MonadEffect-lifted counterparts plus grouped.
changelog.d/20260713_120000_yura_group.mdDocuments the addition and Lua-specific grouping semantics.
.gitignoreIgnores /dist/ artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Unisay
Unisay merged commit 8f7449b into masterJul 14, 2026
2 checks passed
@Unisay
Unisay deleted the yura/issue-268-fork-ffi-console-group-groupcollapsed branch July 14, 2026 06:56
Sign up for freeto 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.

[fork-ffi] console: group, groupCollapsed and groupEnd are missing from the fork

2 participants

@Unisay