[GHC] #9079: Foreign.C.Types in haskell2010

#9079: Foreign.C.Types in haskell2010 -----------------------------------------+--------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/haskell2010 | Version: 7.8.2 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: None/Unknown Blocked By: | Test Case: Related Tickets: | Blocking: -----------------------------------------+--------------------------------- According to Haskell 2010, a marshallable foreign type has to be a `newtype` of a basic type with exposed constructor. Why constructors are not exposed in the module `Foreign.C.Types` from `haskell2010`? When I replace `base` with `haskell2010` in {{{ module Test where import Foreign.C foreign import ccall unsafe "sys/mount.h umount" umount :: CString -> IO CInt }}} I get {{{ Unacceptable result type in foreign declaration: IO CInt When checking declaration: foreign import ccall unsafe "static sys/mount.h umount" umount :: CString -> IO CInt }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 ------------------------------------------+-------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: libraries/haskell2010 | Version: 7.8.2 Resolution: worksforme | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------+-------------------------------- Changes (by simonpj): * cc: core-libraries-committee@… (added) * status: new => closed * resolution: => worksforme Comment: Interesting. `Foreign.C.Types` does export `CInt(..)`. And compiling the module you show works just fine for me: {{{ bash$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.8.2 bash$ ghc -c T9079.hs -fforce-recomp bash$ cat T9079.hs module T9079 where import Foreign.C foreign import ccall unsafe "sys/mount.h umount" umount :: CString -> IO CInt }}} Perhaps you aren't using 7.8.2? I'll close as "worksforme" but if you disagree then please do re-open with more details. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 ------------------------------------------+-------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: libraries/haskell2010 | Version: 7.8.2 Resolution: worksforme | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------+-------------------------------- Comment (by tensor5): I'm talking about compiling using `haskell2010`: {{{ ghc -package haskell2010 -hide-package base Test.hs }}} As I see from [http://git.haskell.org/packages/haskell2010.git/blob/HEAD:/Foreign/C/Types.h... this source] the constructors for C types are not exposed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 ------------------------------------------+-------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/haskell2010 | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------+-------------------------------- Changes (by tensor5): * status: closed => new * resolution: worksforme => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 ------------------------------------------+-------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/haskell2010 | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------+-------------------------------- Comment (by hvr): I believe this is related to the breaking change that went into GHC 7.6.1: {{{ Warning: newtype `CInt' is used in an FFI declaration, but its constructor is not in scope. This will become an error in GHC 7.6.1. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 ------------------------------------------+-------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/haskell2010 | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------+-------------------------------- Comment (by simonpj): Well, this looks to me like a bug in the [http://www.haskell.org/onlinereport/haskell2010/ Haskell 2010 report] * [http://www.haskell.org/onlinereport/haskell2010/haskellch8.html Section 8.4.2 ] says that newtypes must have their constructors visible, and claims that `Foreign.C.Types` follows this convention. * But [http://www.haskell.org/onlinereport/haskell2010/haskellch28.html Chapter 28] which shows `Foreign.C.Types` manifestly does '''not''' follow this convention. That looks like an outright contradiction. I think we should export all the data constructors in `Foreign.C.Types` in the `haskell2010` package. Does anyone disagree? Meanwhile, I'm adding Simon M to the cc list, as editor of the H2010 report. Autin: could you act on this after a suitable delay? Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 -------------------------------------+------------------------------------- Reporter: tensor5 | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ekmett): We've dropped core library support for the `haskell2010` package, due to #9590, but this still seems actionable. Herbert has been exploring ways to get users who really want it a fully compliant `haskell2010` package, and this unfortunate contradiction seems like it'd still impact his efforts on that front. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9079: Foreign.C.Types in haskell2010 -------------------------------------+------------------------------------- Reporter: tensor5 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #PRIME156 | Differential Rev(s): -------------------------------------+------------------------------------- Changes (by hvr): * cc: ekmett (added) * related: => #PRIME156 Comment: See also #PRIME156 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9079#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC