[GHC] #9352: Allow `State# s` argument/result types in `ccall` FFI imports

GHC ghc-devs at haskell.org
Wed Aug 16 00:36:31 UTC 2017


#9352: Allow `State# s` argument/result types in `ccall` FFI imports
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.8.2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #9281, #11032     |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 The behavior observed by hvr in comment:7 is (was?) in fact intentional.
 It is documented in this note in `TyType`,
 {{{
 Note [Marshalling void]
 ~~~~~~~~~~~~~~~~~~~~~~~
 We don't treat State# (whose PrimRep is VoidRep) as marshalable.
 In turn that means you can't write
         foreign import foo :: Int -> State# RealWorld

 Reason: the back end falls over with panic "primRepHint:VoidRep";
         and there is no compelling reason to permit it
 }}}

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


More information about the ghc-tickets mailing list