[Haskell-cafe] zlib build failure on recent GHC

2011-11-07 Thread Ben Gamari
With GHC 1ece7b27a11c6947f0ae3a11703e22b7065a6b6c zlib fails to build,
apparently due to Safe Haskell (bug 5610 [1]). The error is specifically,

$ cabal install zlib
Resolving dependencies...
Configuring zlib-0.5.3.1...
Preprocessing library zlib-0.5.3.1...
Building zlib-0.5.3.1...
[1 of 5] Compiling Codec.Compression.Zlib.Stream ( 
dist/build/Codec/Compression/Zlib/Stream.hs, 
dist/build/Codec/Compression/Zlib/Stream.o )

Codec/Compression/Zlib/Stream.hsc:857:1:
Unacceptable argument type in foreign declaration: CInt
When checking declaration:
  foreign import ccall unsafe static zlib.h inflateInit2_ c_inflateInit2_
:: StreamState - CInt - Ptr CChar - CInt - IO CInt

Codec/Compression/Zlib/Stream.hsc:857:1:
Unacceptable argument type in foreign declaration: CInt
When checking declaration:
  foreign import ccall unsafe static zlib.h inflateInit2_ c_inflateInit2_
:: StreamState - CInt - Ptr CChar - CInt - IO CInt

Codec/Compression/Zlib/Stream.hsc:857:1:
Unacceptable result type in foreign declaration: IO CInt
Safe Haskell is on, all FFI imports must be in the IO monad
When checking declaration:
  foreign import ccall unsafe static zlib.h inflateInit2_ c_inflateInit2_
:: StreamState - CInt - Ptr CChar - CInt - IO CInt
...

This is a little strange since,

  a) It's not clear why Safe Haskell is enabled
  b) The declarations in question seem to be valid

Does this seem like a compiler issue to you?

Cheers,

- Ben

[1] http://hackage.haskell.org/trac/ghc/ticket/5610

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] zlib build failure on recent GHC

2011-11-07 Thread Johan Tibell
On Mon, Nov 7, 2011 at 7:53 AM, Ben Gamari bgamari.f...@gmail.com wrote:

 With GHC 1ece7b27a11c6947f0ae3a11703e22b7065a6b6c zlib fails to build,
 apparently due to Safe Haskell (bug 5610 [1]). The error is specifically,

 $ cabal install zlib
 Resolving dependencies...
 Configuring zlib-0.5.3.1...
 Preprocessing library zlib-0.5.3.1...
 Building zlib-0.5.3.1...
 [1 of 5] Compiling Codec.Compression.Zlib.Stream (
 dist/build/Codec/Compression/Zlib/Stream.hs,
 dist/build/Codec/Compression/Zlib/Stream.o )

 Codec/Compression/Zlib/Stream.hsc:857:1:
Unacceptable argument type in foreign declaration: CInt
When checking declaration:
  foreign import ccall unsafe static zlib.h inflateInit2_
 c_inflateInit2_
:: StreamState - CInt - Ptr CChar - CInt - IO CInt

 Codec/Compression/Zlib/Stream.hsc:857:1:
Unacceptable argument type in foreign declaration: CInt
When checking declaration:
  foreign import ccall unsafe static zlib.h inflateInit2_
 c_inflateInit2_
:: StreamState - CInt - Ptr CChar - CInt - IO CInt

 Codec/Compression/Zlib/Stream.hsc:857:1:
Unacceptable result type in foreign declaration: IO CInt
Safe Haskell is on, all FFI imports must be in the IO monad
When checking declaration:
  foreign import ccall unsafe static zlib.h inflateInit2_
 c_inflateInit2_
:: StreamState - CInt - Ptr CChar - CInt - IO CInt
 ...

 This is a little strange since,

  a) It's not clear why Safe Haskell is enabled
  b) The declarations in question seem to be valid

 Does this seem like a compiler issue to you?


This is due to a change in how FFI imports and newtypes work. GHC was
recently changed to not allow you to use newtypes in FFI imports unless the
constructor of the newtype is in scope. This broke quite a few libraries. I
have patched a few of them and I've sent a patch to the zlib maintainer.

-- Johan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] zlib build failure on recent GHC

2011-11-07 Thread Jason Dagit
On Mon, Nov 7, 2011 at 8:17 AM, Johan Tibell johan.tib...@gmail.com wrote:
 On Mon, Nov 7, 2011 at 7:53 AM, Ben Gamari bgamari.f...@gmail.com wrote:

 With GHC 1ece7b27a11c6947f0ae3a11703e22b7065a6b6c zlib fails to build,
 apparently due to Safe Haskell (bug 5610 [1]). The error is specifically,

 $ cabal install zlib
 Resolving dependencies...
 Configuring zlib-0.5.3.1...
 Preprocessing library zlib-0.5.3.1...
 Building zlib-0.5.3.1...
 [1 of 5] Compiling Codec.Compression.Zlib.Stream (
 dist/build/Codec/Compression/Zlib/Stream.hs,
 dist/build/Codec/Compression/Zlib/Stream.o )

 Codec/Compression/Zlib/Stream.hsc:857:1:
    Unacceptable argument type in foreign declaration: CInt
    When checking declaration:
      foreign import ccall unsafe static zlib.h inflateInit2_
 c_inflateInit2_
        :: StreamState - CInt - Ptr CChar - CInt - IO CInt

 Codec/Compression/Zlib/Stream.hsc:857:1:
    Unacceptable argument type in foreign declaration: CInt
    When checking declaration:
      foreign import ccall unsafe static zlib.h inflateInit2_
 c_inflateInit2_
        :: StreamState - CInt - Ptr CChar - CInt - IO CInt

 Codec/Compression/Zlib/Stream.hsc:857:1:
    Unacceptable result type in foreign declaration: IO CInt
    Safe Haskell is on, all FFI imports must be in the IO monad
    When checking declaration:
      foreign import ccall unsafe static zlib.h inflateInit2_
 c_inflateInit2_
        :: StreamState - CInt - Ptr CChar - CInt - IO CInt
 ...

 This is a little strange since,

  a) It's not clear why Safe Haskell is enabled
  b) The declarations in question seem to be valid

 Does this seem like a compiler issue to you?

 This is due to a change in how FFI imports and newtypes work. GHC was
 recently changed to not allow you to use newtypes in FFI imports unless the
 constructor of the newtype is in scope. This broke quite a few libraries. I
 have patched a few of them and I've sent a patch to the zlib maintainer.

This seems like a big change.  Where should I be watching to know
about this ahead of time?  I bet I have to fix some of my packages.

Thanks,
Jason

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] zlib build failure on recent GHC

2011-11-07 Thread Johan Tibell
On Mon, Nov 7, 2011 at 12:06 PM, Jason Dagit dag...@gmail.com wrote:

  This is due to a change in how FFI imports and newtypes work. GHC was
  recently changed to not allow you to use newtypes in FFI imports unless
 the
  constructor of the newtype is in scope. This broke quite a few
 libraries. I
  have patched a few of them and I've sent a patch to the zlib maintainer.

 This seems like a big change.  Where should I be watching to know
 about this ahead of time?  I bet I have to fix some of my packages.


I suppose it will be in the release notes. I saw it on the GHC mailing list.

-- Johan\
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] zlib build failure on recent GHC

2011-11-07 Thread Daniel Fischer
On Monday 07 November 2011, 21:06:17, Jason Dagit wrote:
 On Mon, Nov 7, 2011 at 8:17 AM, Johan Tibell johan.tib...@gmail.com 
wrote:
  This is due to a change in how FFI imports and newtypes work. GHC was
  recently changed to not allow you to use newtypes in FFI imports
  unless the constructor of the newtype is in scope. This broke quite a
  few libraries. I have patched a few of them and I've sent a patch to
  the zlib maintainer.
 
 This seems like a big change.

But it introduces conformance with the report:

http://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1540008.4 
(sec. 8.4.2, Foreign Types)

Consequently, in order for a type defined by newtype to be used in a 
foreign declaration outside of the module that defines it, the type must 
not be exported abstractly.

Previous behaviour violated that, hence the change.

 Where should I be watching to know
 about this ahead of time?  I bet I have to fix some of my packages.
 
 Thanks,
 Jason

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe