Core Lint check for floating point literal patterns seems to check the wrong thing
Currently, GHC.Core.Lint.lintCaseExpr
disallows floating point literal patterns at type Float
and Double
. However, I think what was probably intended was to forbid floating point literals at types Float#
and Double#
(which makes much more sense to me than just singling out Float
and Double
). Indeed Note [Rules for floating-point comparisons] says:
So we make it an invariant of Core that a case expression never scrutinises a Float# or Double#.
Currently, we can write a pattern match on Double#
using floating point literal patterns, and this doesn't trigger any Core Lint errors:
foo :: Double# -> Int#
foo x =
case x of
0.0## -> 2#
2.0## -> 3#
_ -> 4#
Should we change the check in lintCaseExpr
to check Float#
and Double#
instead?
To be clear, I don't have any buggy behaviour to exhibit here, but the code seemed strange.