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

GHC ghc-devs at haskell.org
Fri Jul 25 12:08:25 UTC 2014


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

Comment (by hvr):

 Fyi, just something I just noticed while implementing a new Cmm primop and
 the associated `prim` FFI import:

 The following doesn't work, as GHC doesn't deem `State#` an acceptable
 return type:

 {{{#!hs
 foreign import prim "integer_gmp_cmm_shrink_mba"
   shrinkMutableByteArray# :: MutableByteArray# s -> Int# -> State# s ->
 State# s
 }}}

 However, the following works:

 {{{#!hs
 foreign import prim "integer_gmp_cmm_shrink_mba"
   shrinkMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#
 State# s #)
 }}}

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


More information about the ghc-tickets mailing list