[GHC] #10460: Allow foreign prim to return Any

GHC ghc-devs at haskell.org
Fri May 29 21:14:22 UTC 2015


#10460: Allow foreign prim to return Any
-------------------------------------+-------------------------------------
              Reporter:  ezyang      |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:  7.12.1
              Priority:  normal      |           Version:  7.11
             Component:  Compiler    |  Operating System:  Unknown/Multiple
  (Type checker)                     |   Type of failure:  GHC rejects
              Keywords:              |  valid program
          Architecture:              |        Blocked By:
  Unknown/Multiple                   |   Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Presently, we have

 {{{
 {-# LANGUAGE GHCForeignImportPrim #-}
 module Serum where
 import GHC.Exts

 foreign import prim "chenycopy" cheneycopy :: Any -> Any
 }}}

 induces the error

 {{{
 Serum.hs:5:1:
     Unacceptable result type in foreign declaration:
       ‘Any’ cannot be marshalled in a foreign call
     When checking declaration:
       foreign import prim safe "static chenycopy" cheneycopy
         :: Any -> Any
 }}}

 We ought to allow a lifted value to be returned from a foreign primop; no
 reason not to, anyway; no reason not to, and there are plenty of built-in
 primops which do this.

 For reference, lifted arguments were allowed in arugments in this commit:

 {{{
 commit e29001c9e0f73885c0b85d86c3a854519448013a
 Author: Joachim Breitner <mail at joachim-breitner.de>  Mon Mar 12 01:20:12
 2012
 Committer:      Simon Marlow <marlowsd at gmail.com>  Wed Mar 14 06:01:18
 2012

 Allow Any as an argument type to foreign prim functions
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10460>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list