While working on https://github.com/clash-lang/ghc-typelits-extra/pull/43 I noticed this bug. It is not allowed to reduce because if b <= 1 then the logarithm will never reduce. This check is already applied if b is a literal but not in the general case.
Easy fix is just adding that check. Which sucks because now existing code will break. Better would be to start emitting new constraints, similar to how ghc-typelits-natnormalise does it. This will still break existing code. But at least the only thing that would need to happen is add the appropriate constraints.
While working on https://github.com/clash-lang/ghc-typelits-extra/pull/43 I noticed this bug. It is not allowed to reduce because if
b <= 1
then the logarithm will never reduce. This check is already applied ifb
is a literal but not in the general case.Easy fix is just adding that check. Which sucks because now existing code will break. Better would be to start emitting new constraints, similar to how
ghc-typelits-natnormalise
does it. This will still break existing code. But at least the only thing that would need to happen is add the appropriate constraints.