Skip to content

rel8-1.7.0.0 fails to build with semialign >= 1.3: missing Unzip (First a) instance #402

@MMZK1526

Description

@MMZK1526

Problem

rel8-1.7.0.0 fails to compile when semialign >= 1.3 is resolved. semialign-1.3 made Unzip a superclass of Semialign, but Rel8.Schema.HTable.Vectorize defines instance Semialign (First a) without a corresponding Unzip (First a) instance.

Error:

src/Rel8/Schema/HTable/Vectorize.hs:200:10: error: [GHC-39999]
    • No instance for 'Unzip (First a)'
        arising from the superclasses of an instance declaration
    • In the instance declaration for 'Semialign (First a)'
    |
200 | instance Semialign (First a) where
    |          ^^^^^^^^^^^^^^^^^^^

Root cause

In semialign >= 1.3, the class hierarchy changed so that Semialign requires Unzip as a superclass (class Unzip f => Semialign f). The Unzip import in Vectorize.hs also omits (..), so the methods are not in scope.

Who is affected

Any project that depends on both rel8 and a package that transitively requires semialign >= 1.3. In practice, aeson >= 2.2 pulls in semialign >= 1.3, so users of rel8 + aeson >= 2.2 on a clean build will hit this.

rel8's own cabal.project uses allow-newer: *:base which forces semialign-1.2.x and hides the issue.

Fix

Two changes to src/Rel8/Schema/HTable/Vectorize.hs:

  1. Import Unzip with its methods: import Data.Zip (Unzip (..), Zip, Zippy(..), zipWith)
  2. Add the missing instance before Semialign (First a):
instance Unzip (First a) where
  unzipWith _ (First a) = (First a, First a)

A working patch is available at: https://github.com/MMZK1526/rel8/tree/fix-unzip (based on the 0e1acf0 / v1.7.0 commit).

Environment

  • GHC 9.6.7
  • rel8 1.7.0.0
  • semialign 1.3+ (e.g. 1.4)
  • aeson 2.2+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions