Closed andygill closed 6 years ago
Ah, I think I know what's going on. The normalising code from ghc-typelits-natnormalise
that is used in ghc-typelits-knownnat
normalised the type
h - (kh - 1)
to:
1 + (h - kh)
which lead to the kh <= h
constraint.
I think when I've properly fixed https://github.com/clash-lang/ghc-typelits-natnormalise/issues/14 I'll be able to fix this bug as well. It will then get as constraints:
1 <= kh, kh-1 <= h
I think the gist of it is: subtraction is annoying when trying to prove things about it.
Consider this example
The plugin infers
kh <= h
, which is too strong; it should inferkh-1 <= h
, or evenkh <= h + 1
.