Allow foreign prim to return Any
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@joachim-breitner.de> Mon Mar 12 01:20:12 2012
Committer: Simon Marlow <marlowsd@gmail.com> Wed Mar 14 06:01:18 2012
Allow Any as an argument type to foreign prim functions
I can volunteer to write the patch but it would be good if someone else OKs this before I proceed.