Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: igloo Type: bug | Status: new Priority: normal |Milestone: 7.4.1 Component: Compiler (FFI) | Version: 6.10.1 Keywords: FFI | Testcase: Blockedby: | Difficulty: Unknown Os: Linux | Blocking: Architecture: x86_64 (amd64) | Failure: None/Unknown ---+ Comment(by igloo@…): commit 5b988961338f73af5790bfd365ca79c858249cea {{{ Author: Ian Lynagh ig...@earth.li Date: Fri Sep 30 21:57:53 2011 +0100 Handle newtypes and type functions correctly in FFI types; fixes #3008 You can now use type functions in FFI types. Newtypes are now only looked through if the constructor is in scope. compiler/deSugar/DsCCall.lhs |4 +- compiler/deSugar/DsForeign.lhs | 82 +++- compiler/deSugar/DsMeta.hs |2 +- compiler/hsSyn/Convert.lhs |4 +- compiler/hsSyn/HsDecls.lhs | 32 +++- compiler/hsSyn/HsUtils.lhs |2 +- compiler/parser/RdrHsSyn.lhs |6 +- compiler/rename/RnNames.lhs |2 +- compiler/rename/RnSource.lhs |8 +- compiler/typecheck/TcForeign.lhs | 160 +- compiler/typecheck/TcHsSyn.lhs |4 +- compiler/typecheck/TcType.lhs| 50 compiler/types/FamInstEnv.lhs|2 +- utils/ghctags/Main.hs|2 +- 14 files changed, 214 insertions(+), 146 deletions(-) }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations -+-- Reporter: waern | Owner: igloo Type: bug | Status: closed Priority: normal | Milestone: 7.4.1 Component: Compiler (FFI) |Version: 6.10.1 Resolution: fixed | Keywords: FFI Testcase: | Blockedby: Difficulty: Unknown | Os: Linux Blocking: | Architecture: x86_64 (amd64) Failure: None/Unknown| -+-- Changes (by igloo): * status: new = closed * resolution: = fixed Comment: Fixed. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: igloo Type: bug | Status: new Priority: normal |Milestone: 7.4.1 Component: Compiler (FFI) | Version: 6.10.1 Keywords: FFI | Testcase: Blockedby: | Difficulty: Unknown Os: Linux | Blocking: Architecture: x86_64 (amd64) | Failure: None/Unknown ---+ Comment(by igloo@…): commit 4027a7ddea293c539626b17b6b434bd4f0860f80 {{{ Author: Ian Lynagh ig...@earth.li Date: Sun Sep 11 20:53:18 2011 +0100 When checking FFI types are IO, don't look through abstract newtypes; #3008 compiler/typecheck/TcForeign.lhs | 53 + 1 files changed, 47 insertions(+), 6 deletions(-) }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: igloo Type: bug | Status: new Priority: normal |Milestone: 7.2.1 Component: Compiler (FFI) | Version: 6.10.1 Keywords: FFI | Testcase: Blockedby: | Difficulty: Unknown Os: Linux | Blocking: Architecture: x86_64 (amd64) | Failure: None/Unknown ---+ Changes (by igloo): * owner: chak = igloo -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: igloo Type: bug | Status: new Priority: normal |Milestone: 7.4.1 Component: Compiler (FFI) | Version: 6.10.1 Keywords: FFI | Testcase: Blockedby: | Difficulty: Unknown Os: Linux | Blocking: Architecture: x86_64 (amd64) | Failure: None/Unknown ---+ Changes (by igloo): * milestone: 7.2.1 = 7.4.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: chak Type: bug | Status: new Priority: normal |Milestone: 7.2.1 Component: Compiler (FFI) | Version: 6.10.1 Keywords: FFI | Testcase: Blockedby: | Difficulty: Unknown Os: Linux | Blocking: Architecture: x86_64 (amd64) | Failure: None/Unknown ---+ Changes (by simonmar): * component: Compiler = Compiler (FFI) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern | Owner: chak Type: bug | Status: new Priority: normal| Milestone: 6.14.1 Component: Compiler |Version: 6.10.1 Resolution:| Keywords: FFI Difficulty: Unknown | Os: Linux Testcase:| Architecture: x86_64 (amd64) Failure: None/Unknown | ---+ Changes (by igloo): * failure: = None/Unknown * milestone: 6.12.1 = 6.14.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: chak Type: bug | Status: new Priority: normal |Milestone: 6.12.1 Component: Compiler| Version: 6.10.1 Severity: normal | Resolution: Keywords: FFI | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | ---+ Changes (by simonpj): * owner: = chak Comment: The bug in the FFI spec is fixed in the 2009 Haskell Prime iteration. Manuel says that now we need to * Fix GHC to refuse to transparently marshal opaque newtypes * Fix the FFI libraries not to expect GHC to do so Moreover he generously says I'm happy to apply those changes, but it won't be right now, as I have a backlog of things to get through. So I'll assign this ticket to you, Manuel. Thanks. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: Type: bug | Status: new Priority: normal |Milestone: 6.12.1 Component: Compiler| Version: 6.10.1 Severity: normal | Resolution: Keywords: FFI | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | ---+ Changes (by simonpj): * milestone: 6.12 branch = 6.12.1 Comment: Let's try to resolve this for 6.21.1 Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: Type: bug | Status: new Priority: normal |Milestone: 6.12 branch Component: Compiler| Version: 6.10.1 Severity: normal | Resolution: Keywords: FFI | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | ---+ Changes (by igloo): * milestone: = 6.12 branch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern |Owner: Type: bug | Status: new Priority: normal |Milestone: Component: Compiler| Version: 6.10.1 Severity: normal | Resolution: Keywords: FFI | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | ---+ Changes (by simonpj): * difficulty: = Unknown Comment: Excellent report. The real culprit is in the FFI spec: see http://www.haskell.org/pipermail /haskell-prime/2009-February/002726.html. Until that thread is resolved, you can work around this bug by exporting `GL(..)`. Indeed, if my proposal is accepted, you'll be forced to do that. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations ---+ Reporter: waern | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 6.10.1 | Severity: normal Keywords: FFI | Testcase: Os: Linux | Architecture: x86_64 (amd64) ---+ Take a look at these two modules: A.hs: {{{ module A (GL) where import Control.Monad import Control.Monad.Trans newtype GL a = GL (IO a) deriving (Functor, Monad, MonadIO) }}} B.hs: {{{ module B where import A foreign import CALLCONV unsafe glFlush flush :: GL () }}} Now, compile them with optimizations: {{{ [da...@alonzo temp]$ $HOME/ghc-6.10.1/bin/ghc A.hs B.hs -XGeneralizedNewtypeDeriving -XForeignFunctionInterface -DCALLCONV=ccall -XCPP -O compilation IS NOT required compilation IS NOT required A.o:(.text+0x8e): undefined reference to `mtlzm1zi1zi0zi2_ControlziMonadziTrans_ZCDMonadIO_con_info' A.o:(.text+0x237): undefined reference to `__stginit_mtlzm1zi1zi0zi2_ControlziMonadziTrans_' B.o:(.text+0x1e): undefined reference to `glFlush' /home/david/ghc-6.10.1//lib/ghc-6.10.1/libHSrts.a(Main.o): In function `real_main': Main.c:(.text+0x12): undefined reference to `__stginit_ZCMain' Main.c:(.text+0x26): undefined reference to `ZCMain_main_closure' collect2: ld returnerade avslutningsstatus 1 }}} It's OK - we pass the typechecking phase. Now, see what happens when we compile without `-O`: {{{ [da...@alonzo temp]$ rm -f *.hi *.o [da...@alonzo temp]$ $HOME/ghc-6.10.1/bin/ghc A.hs B.hs -XGeneralizedNewtypeDeriving -XForeignFunctionInterface -DCALLCONV=ccall -XCPP B.hs:5:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe static glFlush flush :: GL () }}} Putting everything into one single module makes the type error go away completely (that is, also when compiling without `-O`). Something strange must be going on. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3008: Strange behavior when using newtyped version of IO monad in FFI import declarations
#3008: Strange behavior when using newtyped version of IO monad in FFI import declarations --+- Reporter: waern | Owner: Type: bug | Status: new Priority: normal| Milestone: Component: Compiler |Version: 6.10.1 Severity: normal| Resolution: Keywords: FFI | Testcase: Os: Linux | Architecture: x86_64 (amd64) --+- Comment (by waern): Please disregard the COMPILATION IS NOT REQUIRED lines in the first console output. I just ran the exact same command twice. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3008#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs