g (F# f) =
        let w     = W32# (unsafeCoerce# f)

Why does GHC even accept this code?
I think unsafeCoerce# is not intended to be able to coerce unboxed values.


Prelude GHC.Base> :t unsafeCoerce#
unsafeCoerce# :: forall b a. a -> b

The type variables a and b are supposed to be of kind *, and f is of kind #.
If we have any other function of type a -> b, for example


foo :: a -> b
foo _ = undefined

Then GHCi rejects "foo 1.0#" and prints:

<interactive>:1:4:
    Couldn't match kind `*' against `#'
    When matching the kinds of `t :: *' and `Float# :: #'
      Expected type: t
      Inferred type: Float#
    In the first argument of `foo', namely `1.0#'

Cheers,

Wolfgang

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to