From 5382a7672a9bd99895911bb36014b4aaa3c4322b Mon Sep 17 00:00:00 2001 From: tegwick Date: Fri, 1 May 2026 23:13:26 +0200 Subject: [PATCH] fix(build): capture type aliases in ActualTypes hub export list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IHP entity pattern: data Foo' params = Foo {...} (primed type, unprimed ctor) type Foo = Foo' arg1 arg2 (concrete alias, kind *) Include type instances use [Foo] — needs the concrete type alias (kind *), not the primed data type. Previous awk only matched data/newtype, missing the type alias. Add /^type [A-Z]/ match (no (..) suffix — type aliases are not ADTs). type instance lines start with lowercase 'i' and don't match. Co-Authored-By: Claude Sonnet 4.6 --- flake.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index da1d991..faa4236 100644 --- a/flake.nix +++ b/flake.nix @@ -128,15 +128,21 @@ postUnpack = (old.postUnpack or "") + '' _actual="$sourceRoot/build/Generated/ActualTypes.hs" - # Rewrite hub export list: (module N, ...) → (T(..), ...) - # Extract all data/newtype names from inner module files. + # Rewrite hub export list: (module N, ...) → explicit names. + # IHP pattern: data Foo' params = Foo {...} (primed type, unprimed ctor) + # type Foo = Foo' arg1 arg2 (concrete alias, kind *) + # ADTs: export T(..) to include type + ctor + fields. + # type aliases: export T (no (..) — not an ADT). + # type instance lines start with lowercase 'i', so don't match [A-Z]. _types=$( { - awk '/^data [A-Z]|^newtype [A-Z]/{print $2"(..)"}' \ + awk '/^data [A-Z]|^newtype [A-Z]/{print $2"(..)"} + /^type [A-Z]/{print $2}' \ "$sourceRoot/build/Generated/Enums.hs" find "$sourceRoot/build/Generated/ActualTypes" -name "*.hs" | \ sort | while IFS= read -r _m; do - awk '/^data [A-Z]|^newtype [A-Z]/{print $2"(..)"}' "$_m" + awk '/^data [A-Z]|^newtype [A-Z]/{print $2"(..)"} + /^type [A-Z]/{print $2}' "$_m" done } | sort -u )