I came across the following code in GHC.Prim:
...
negateFloat# :: Float# -> Float#
negateFloat# = let x = x in x
-- |Truncates a @Float#@ value to the nearest @Int#@.
-- Results are undefined if the truncation if truncation yields
-- a value outside the range of @Int#@.
float2Int# :: Float# -> Int#
float2Int# = let x = x in x
expFloat# :: Float# -> Float#
expFloat# = let x = x in x
logFloat# :: Float# -> Float#
logFloat# = let x = x in x
...
In particular:
float2Int#
shouldn't even type check- None of the functions take an argument and hence seem to be malformed
- None of the functions apply the mathematical operation they claim to
- All of the functions are "infinitely recursive":
let x = x
I know the extension is called "MagicHash", but it can't be that magical. What gives?
(I guess I should add the disclaimer that I have no idea what -XMagicHash
actually does, I just assumed it allowed the #
syntax, and nothing more.)