Skip to content

Conversation

@kleinreact
Copy link
Member

@kleinreact kleinreact commented Oct 24, 2025

The PR introduces some preparations for #3061 to make Clash.Sized.Vector compile with ghc-typelits-natnormalise-0.9.1, ghc-typelits-knownnat-0.8.2, and ghc-typelits-extra-0.5.1.

The update avoids the erroneous, but currently required unification under type families (cf. clash-lang/ghc-typelits-natnormalise#108), which has been fixed by clash-lang/ghc-typelits-natnormalise@c994419.

The modifications are only introduced for GHCs between 9.4 and 9.10, as the introduced fix won't work for GHCs prior to 9.4 and is not needed any more with GHC 9.12 due to ghc/ghc@a63ee33.

Still TODO:

  • Write a changelog entry (see changelog/README.md)
  • Check copyright notices are up to date in edited files

@kleinreact kleinreact mentioned this pull request Oct 24, 2025
5 tasks
@kleinreact
Copy link
Member Author

kleinreact commented Oct 24, 2025

I have now clue why the doctest is suddenly failing now.

In terms of semantics the implementation should not have changed in any way at all.

<no location info>: warning: [GHC-98887]
    -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
[ERROR  ] [ThreadId 638] /builds/clash-lang/clash-compiler/clash-prelude/src/Clash/Sized/RTree.hs:531: failure in expression `replaceTree 9 6 (BR (BR (LR 1) (LR 2)) (BR (LR 3) (LR 4)))'
[ERROR  ] [ThreadId 638] expected: <<1,2>,<3,*** Exception: Clash.Sized.Vector.replace: index 9 is out of bounds: [0..3]
[ERROR  ] [ThreadId 638]           ...
[ERROR  ] [ThreadId 638]  but got: <<1,2>,<3,4>>
[ERROR  ] [ThreadId 638]                     ^

@christiaanb
Copy link
Member

The old version of go was strict in the Vec argument.

@kleinreact kleinreact force-pushed the bump-typelit-plugins-preparations branch 2 times, most recently from 5deebd1 to 9e1386c Compare October 24, 2025 19:04
@kleinreact
Copy link
Member Author

I added the strictness requirement in the argument again, which fixes the failing doctest. However, the pattern matches require some additional inaccessibility proofs for the non-reachable cases then, which have been added as well.

This version will also work with the updated plugins avoiding the issue reported in clash-lang/ghc-typelits-natnormalise#108.

@kleinreact kleinreact force-pushed the bump-typelit-plugins-preparations branch from 9e1386c to ccfbd7e Compare October 26, 2025 06:35
@kleinreact kleinreact marked this pull request as ready for review October 26, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants