Skip to content

Error on -Wx-partial#6179

Draft
sellout wants to merge 12 commits intounisonweb:trunkfrom
sellout:remove-x-partial
Draft

Error on -Wx-partial#6179
sellout wants to merge 12 commits intounisonweb:trunkfrom
sellout:remove-x-partial

Conversation

@sellout
Copy link
Copy Markdown
Contributor

@sellout sellout commented Mar 4, 2026

Overview

GHC 9.8 added custom warning categories, and 9.10 added warnings to head and tail in the custom x-partial category. The upgrade to GHC 9.10 downgraded x-partial so it wouldn’t error. This undoes the downgrading, fixing all x-partial occurrences.

Implementation approach and notes

There are a few different approaches, including

  • changing code from [] to NonEmpty,
  • using an infinite stream (Cofix ((,) a)), and
  • replacing tail with drop 1 when appropriate.

Interesting/controversial decisions

This expands the unison-util-recursion package slightly, adding corecursion support for the infinite streams. It again raises the question of instead adding a dependency on yaya or recursion-schemes.

Test coverage

This is a refactoring, it should be covered by existing tests.

sellout added 11 commits March 4, 2026 15:10
Instead of disabling it project-wide, only do it for the files that
trigger it. This makes it easier to fix a single instance at a time.
There is one module that still disables `-Wx-partial`, with a comment
that says when it can be fixed.
There are a couple comments in here where we could perhaps avoid
converting `NonEmpty` to `[]`, but they lead to some pretty deep cascading
changes.
@sellout sellout force-pushed the remove-x-partial branch from 7136ac3 to 4809fc2 Compare March 4, 2026 22:10
Also remove another `-Wx-partial` that was added on trunk.
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