
#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: #9218 Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by hvr): As first proof-of-concept, I made the type-checker allow `State# s` to see if it would just-work(tm), here's the Cmm output resulting from the `foo` declaration: {{{#!c [section "data" { M.c_foo_closure: const M.c_foo_info; }, M.c_foo_entry() // [R2] { info_tbl: [(c1Cx, label: M.c_foo_info rep:HeapRep static { Fun {arity: 2 fun_type: ArgSpec 4} })] stack_info: arg_space: 8 updfr_space: Just 8 } {offset c1Cx: _s1Cl::I64 = R2; goto c1Cz; c1Cz: _c1Cv::I64 = foo; _c1Cw::I64 = _s1Cl::I64; call "ccall" arg hints: [‘signed’] result hints: [] (_c1Cv::I64)(_c1Cw::I64); call (P64[Sp])() args: 8, res: 0, upd: 8; } }] }}} Compiling `bar` however, results in {{{ ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.9.20140723 for x86_64-unknown-linux): resultWrapper (# State# s, Int# #) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9352#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler