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 )