[Haskell-cafe] Problem with haddock 2.3.0 (again)

Thomas Schilling nominolo at googlemail.com
Fri Dec 12 07:22:44 EST 2008


The fromJust error is a bug, of course, however, the underlying
problem is a bit more difficult:

Haddock doesn't generate any code, it only typechecks.  If the code
uses Template Haskell, however, the typechecker will have to run
Haskell code and potentially this code will have to come from a module
of the same package.  If the code indeed comes from the same package,
fixing the fromJust error will just lead to GHCi linker error, since
Haddock didn't generate any code for these.

Here are a couple of solutions and non-solutions:

  - Detect whether a package uses TH by looking at the ghc flags and
the OPTIONS pragmas.  This might work in many cases, but:

      - We cannot generate Bytecode for all modules, because unboxed
tuples and foreign exports are not supported by GHCi.  This drawback
would only affect a few packages, though, and cpp magic could hide the
tricky parts from Haddock.

      - The bigger issue is security.  TH can run arbitrary IO actions
so, by default, we should just fail, and only enable it if the user
says so.

 - Skip modules using TH.  Won't work, because other modules may
depend on those modules.  We also cannot know which modules may
require TH if the flag is set globally.

 - Disallow TH.  That'll require a way to use #ifdef's to show
alternative code.  I guess, that's the current workaround.

 - Do a best-effort Renaming pass and run the typechecker without
trying to resolve Splices.  Lot's of work and may result to incorrect
documentation, so I'm not sure it's worth it.

Any other?

/ Thomas

2008/12/12 Sean Leather <leather at cs.uu.nl>:
>
>>> > I've been using "cabal haddock" to run haddock on my package. I also
>>> > get the same error using haddock directly:
>>> >
>>> > > $ haddock -odir=tmp --debug --verbose --html
>>> > Generics/EMGM.hs
>>> > > haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing
>>>
>>> Have you filed a ticket for this in the haddock trac so that he doesn't
>>> forget?
>>> http://trac.haskell.org/haddock/
>>
>> There seemed to be perhaps one or two tickets related, but I wasn't sure
>> if any exactly matched the issue, so I created a new one with a minimal
>> testcase.
>>
>> http://trac.haskell.org/haddock/ticket/68
>
> And for anyone who later comes upon this thread seeking an answer to a
> similar problem, this is apparently a bug in the GHC API on which Haddock is
> dependent:
>
> http://hackage.haskell.org/trac/ghc/ticket/2739
>
> Regards,
> Sean
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



-- 
Push the envelope.  Watch it bend.


More information about the Haskell-Cafe mailing list