[GHC] #10460: Allow foreign prim to return Any
GHC
ghc-devs at haskell.org
Mon Jun 1 11:41:04 UTC 2015
#10460: Allow foreign prim to return Any
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: feature request | Status: new
Priority: normal | Milestone: 7.12.1
Component: Compiler (Type | Version: 7.11
checker) | Keywords:
Resolution: | Architecture:
Operating System: Unknown/Multiple | Unknown/Multiple
Type of failure: GHC rejects | Test Case:
valid program | Blocking:
Blocked By: | Differential Revisions:
Related Tickets: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Generally ok but
* The ability to pass `Any` to `foreign import prim` is not documented in
[https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi.html
#ffi-prim 8.1.3 of the user manual], and it jolly well should be. If you
want to extend this to arbitrary FFI imports then we should document that
too.
* Who converts the argument to `Any`? The caller? With `unsafeCoerce`?
* You should never combine a '''safe''' foreign import with `Any`. "Safe"
means that the call may block and GC may happen, so passing a pointer into
the heap is a bad idea. (And this constraint should be documented.)
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10460#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list