Unacceptable result type in FFI

How do you get Haddock 2.4 to handle the return type of an FFI function that isnt "IO". It works automatically in the haddock version that ships with ghc 6.8.1. I tried: haddock --haddock-options=--optghc=-XGeneralizedNewtypeDe riving

2008/11/16 Neal Alexander
How do you get Haddock 2.4 to handle the return type of an FFI function that isnt "IO". It works automatically in the haddock version that ships with ghc 6.8.1.
I tried:
haddock --haddock-options=--optghc=-XGeneralizedNewtypeDe riving
I don't see why this would be a problem. What kind of error message do you get? I can't test myself right now since I'm at work. Thanks, David

Graphics/Rendering/OGL/GL/FlushFinish.hs:39:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe "static &glFlush" flush :: GL () Graphics/Rendering/OGL/GL/FlushFinish.hs:47:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe "static &glFinish" finish :: GL () haddock: Failed to check module: Graphics.Rendering.OGL.GL.FlushFinish ------------- The error message is the same as what GHC would give without -XGeneralizedNewtypeDeriving. full log here: http://hackage.haskell.org/packages/archive/OGL/0.0.0/logs/failure/ghc-6.10 David Waern wrote:
2008/11/16 Neal Alexander
: How do you get Haddock 2.4 to handle the return type of an FFI function that isnt "IO". It works automatically in the haddock version that ships with ghc 6.8.1.
I tried:
haddock --haddock-options=--optghc=-XGeneralizedNewtypeDe riving
I don't see why this would be a problem. What kind of error message do you get?
I can't test myself right now since I'm at work.
Thanks, David

2008/11/17 Neal Alexander
Graphics/Rendering/OGL/GL/FlushFinish.hs:39:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe "static &glFlush" flush :: GL ()
Graphics/Rendering/OGL/GL/FlushFinish.hs:47:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe "static &glFinish" finish :: GL () haddock: Failed to check module: Graphics.Rendering.OGL.GL.FlushFinish
-------------
The error message is the same as what GHC would give without -XGeneralizedNewtypeDeriving.
Hm, if you don't turn on GeneralizedNewtypeDeriving with GHC, shouldn't it fail earlier on the definition of the newtype that you are deriving things for?
full log here:
http://hackage.haskell.org/packages/archive/OGL/0.0.0/logs/failure/ghc-6.10
David Waern wrote:
2008/11/16 Neal Alexander
: How do you get Haddock 2.4 to handle the return type of an FFI function that isnt "IO". It works automatically in the haddock version that ships with ghc 6.8.1.
I tried:
haddock --haddock-options=--optghc=-XGeneralizedNewtypeDe riving
You should not pass --haddock-options to haddock itself. It's used to tell Cabal which options to give to Haddock. So the right line would be:
haddock --optghc=-XGeneralizedNewtypeDeriving
David

Hm, if you don't turn on GeneralizedNewtypeDeriving with GHC, shouldn't it fail earlier on the definition of the newtype that you are deriving things for?
Yea, it looks like it does honor -XForeignFunctionInterface. The "Monad.hs" below defines the newtypes, and haddock doesn't seem to have a problem with it.
You should not pass --haddock-options to haddock itself. It's used to tell Cabal which options to give to Haddock. So the right line would be:
haddock --optghc=-XGeneralizedNewtypeDeriving
Sorry, was a bad paste, i was running it through Cabal's Setup.hs. Heres the output from running haddock directly on the two files: ------------------ $ haddock.exe -v \ --optghc=-XGeneralizedNewtypeDeriving \ --optghc=-DCALLCONV=ccall \ --optghc=-XCPP --optghc=-XForeignFunctionInterface \ Graphics/Rendering/OGL/GL/FlushFinish.hs Graphics\Rendering\OGL\GL\FlushFinish.hs:39:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe "static &glFlush" flush :: GL () Graphics\Rendering\OGL\GL\FlushFinish.hs:47:0: Unacceptable result type in foreign declaration: GL () When checking declaration: foreign import ccall unsafe "static &glFinish" finish :: GL () haddock: Failed to check module: Graphics.Rendering.OGL.GL.FlushFinish ------------------ $ haddock.exe -v \ --optghc=-XGeneralizedNewtypeDeriving --optghc=-DCALLCONV=ccall --optghc=-XCPP --optghc=-XForeignFunctionInterface Graphics/Rendering/OGL/Monad.hs Warning: main:Graphics.Rendering.OGL.Monad: could not find link destinations for: GHC.IOBase.IO Control.Arrow.Kleisli GHC.Base.Monad GHC.Base.Functor Control.Monad.Trans.MonadIO ### looks ok. -----------------

Sorry, I forgot about this thread. Do you still have this problem?
Regards,
David
2008/11/16 Neal Alexander
How do you get Haddock 2.4 to handle the return type of an FFI function that isnt "IO". It works automatically in the haddock version that ships with ghc 6.8.1.
I tried:
haddock --haddock-options=--optghc=-XGeneralizedNewtypeDe riving
_______________________________________________ HaskellDoc mailing list HaskellDoc@haskell.org http://www.haskell.org/mailman/listinfo/haskelldoc

David Waern wrote:
Sorry, I forgot about this thread. Do you still have this problem?
Regards, David
2008/11/16 Neal Alexander
: How do you get Haddock 2.4 to handle the return type of an FFI function that isnt "IO". It works automatically in the haddock version that ships with ghc 6.8.1.
I tried:
haddock --haddock-options=--optghc=-XGeneralizedNewtypeDe riving
_______________________________________________ HaskellDoc mailing list HaskellDoc@haskell.org http://www.haskell.org/mailman/listinfo/haskelldoc
Yea, i haven't tried to fix it since then though.

2008/12/4 Neal Alexander
David Waern wrote:
Sorry, I forgot about this thread. Do you still have this problem?
Regards, David
Yea, i haven't tried to fix it since then though.
I took a look at this problem again, and I think I nailed down to a GHC bug (but you can never be sure): http://hackage.haskell.org/trac/ghc/ticket/3008 David

David Waern wrote:
2008/12/4 Neal Alexander
: David Waern wrote:
Sorry, I forgot about this thread. Do you still have this problem?
Regards, David Yea, i haven't tried to fix it since then though.
I took a look at this problem again, and I think I nailed down to a GHC bug (but you can never be sure):
http://hackage.haskell.org/trac/ghc/ticket/3008
David
Thanks for looking at it again. I tried passing -O* to ghc through haddock but it doesn't seem to do anything. So I figured i'd try replacing the imports at the top of files with something like: import Graphics.Rendering.OGL.Monad hiding (GL) import Control.Monad import Control.Monad.Trans newtype GL a = GL (IO a) deriving (Functor, Monad, MonadIO) Which fixes the error, but GL and Graphics.Rendering.OGL.Monad.GL aren't treated as equivalent. I just generated the documentation with an older version and linked it on the package's wiki page so its not a big deal either way. I'm pretty sure its GHC's fault not haddock.

2009/2/8 Neal Alexander
David Waern wrote:
2008/12/4 Neal Alexander
: David Waern wrote:
Sorry, I forgot about this thread. Do you still have this problem?
Regards, David
Yea, i haven't tried to fix it since then though.
I took a look at this problem again, and I think I nailed down to a GHC bug (but you can never be sure):
http://hackage.haskell.org/trac/ghc/ticket/3008
David
Thanks for looking at it again.
I tried passing -O* to ghc through haddock but it doesn't seem to do anything.
I know! I was also confused by this. But it could perhaps have something to do with the fact that Haddock doesn't compile anything, at least if you're using one of latest versions :) So, I hoping for htis to be a GHC error. David

David Waern wrote:
2009/2/8 Neal Alexander
: David Waern wrote:
2008/12/4 Neal Alexander
: David Waern wrote:
Sorry, I forgot about this thread. Do you still have this problem?
Regards, David Yea, i haven't tried to fix it since then though. I took a look at this problem again, and I think I nailed down to a GHC bug (but you can never be sure):
http://hackage.haskell.org/trac/ghc/ticket/3008
David Thanks for looking at it again.
I tried passing -O* to ghc through haddock but it doesn't seem to do anything.
I know! I was also confused by this. But it could perhaps have something to do with the fact that Haddock doesn't compile anything, at least if you're using one of latest versions :) So, I hoping for htis to be a GHC error.
David
For the mailing list's reference: --------------------------- 02/12/09 01:25:40 changed by simonpj 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
participants (2)
-
David Waern
-
Neal Alexander