Skip to content

Avoid Haddock-links to the Prelude

If you're generating documenatation that links to the base package, you will see that some links to standard types go to the Prelude and some to the hierarchical libararies. For example, Int goes to Prelude.Int, while Either goes to Data.Either.Either.

This happens because the Prelude imports some types from the hierarchical libraries, while some are imported directly from internal GHC modules (e.g. GHC.Base). In the first case, the hierarchical module is choosen as the best place to link to since it's closer than the Prelude in the topological sort to the original module. In the latter case, the hierarchical module and the Prelude are of equal number of imports away from the original module, so none is considered a better place to link to. In this case one of the modules is arbitrarily chosen and it happens to be the Prelude.

I think it would be nice if the links would always go to the hierarchical libraries. Maybe the best way to achieve that would be to add {-# OPTIONS_HADDOCK NotHome #-} to the Prelude. This flag is not yet documented (I should get around to that). It tells Haddock to prefer linking to another module if one is available.

Desired Home modules

Desired Home Modules

I'm using this format where NEW means the home module doesn't currently export this entity:

Desired.Home.Module
===================
a
b
NEW c
Control.Monad
=============
GHC.Base.=<<


Data.Bool
=========
GHC.Classes.&&
GHC.Classes.not
GHC.Classes.||

NEW Data.Bounded
=============
GHC.Enum.Bounded
  { GHC.Enum.maxBound
  , GHC.Enum.minBound }


NEW Data.Enum
=========
GHC.Enum.Enum
  { GHC.Enum.enumFrom
  , GHC.Enum.enumFromThen
  , GHC.Enum.enumFromThenTo
  , GHC.Enum.enumFromTo
  , GHC.Enum.fromEnum
  , GHC.Enum.pred
  , GHC.Enum.succ
  , GHC.Enum.toEnum }


NEW Data.Error
  * Alternatively Control.Exception (for error, errorWithoutStackTrace, undefined)
==========
GHC.Err.error
GHC.Err.errorWithoutStackTrace
GHC.Err.undefined


Data.Function
=============
GHC.Base.($)
GHC.Base.(.)
GHC.Base.id
GHC.Base.flip
GHC.Base.const
NEW GHC.Base.($!)
  * Similar to ($)
NEW GHC.Base.asTypeOf
  * Similar to `const`
NEW GHC.Base.until
  * Meets the modules description of being functions on pure functions.


Data.List
=========
GHC.Base.++
GHC.Base.map
GHC.List.!!
GHC.List.break
GHC.List.cycle
GHC.List.drop
GHC.List.dropWhile
GHC.List.filter
GHC.List.head
GHC.List.init
GHC.List.iterate
GHC.List.last
GHC.List.lookup
GHC.List.repeat
GHC.List.replicate
GHC.List.reverse
GHC.List.scanl
GHC.List.scanl1
GHC.List.scanr
GHC.List.scanr1
GHC.List.span
GHC.List.splitAt
GHC.List.tail
GHC.List.take
GHC.List.takeWhile
GHC.List.unzip
GHC.List.unzip3
GHC.List.zip
GHC.List.zip3
GHC.List.zipWith
GHC.List.zipWith3


NEW Data.Seq
  * This module seems a bit too empty
=====================================
GHC.Prim.seq


NEW Numeric.Integral
  * Why not Data.Integral?
==========================
GHC.Real.Integral
  { GHC.Real.div
  , GHC.Real.divMod
  , GHC.Real.mod
  , GHC.Real.quot
  , GHC.Real.quotRem
  , GHC.Real.rem
  , GHC.Real.toInteger }
GHC.Real.even
GHC.Real.gcd
GHC.Real.lcm
GHC.Real.odd



TODO pick a home module for these entities
==========================================
GHC.Base.Applicative{GHC.Base.*>, GHC.Base.<*, GHC.Base.<*>, GHC.Base.pure}
GHC.Base.Functor{GHC.Base.<$, GHC.Base.fmap}
GHC.Base.Monad{GHC.Base.>>, GHC.Base.>>=, GHC.Base.return}
GHC.Base.Monoid{GHC.Base.mappend, GHC.Base.mconcat, GHC.Base.mempty}
GHC.Base.otherwise
GHC.Base.Semigroup{GHC.Base.<>}
GHC.Base.String
GHC.Classes.Eq{GHC.Classes./=, GHC.Classes.==}
GHC.Classes.Ord{GHC.Classes.<, GHC.Classes.<=, GHC.Classes.>, GHC.Classes.>=, GHC.Classes.compare, GHC.Classes.max, GHC.Classes.min}
GHC.Float.Floating{GHC.Float.**, GHC.Float.acos, GHC.Float.acosh, GHC.Float.asin, GHC.Float.asinh, GHC.Float.atan, GHC.Float.atanh, GHC.Float.cos, GHC.Float.cosh, GHC.Float.exp, GHC.Float.log, GHC.Float.logBase, GHC.Float.pi, GHC.Float.sin, GHC.Float.sinh, GHC.Float.sqrt, GHC.Float.tan, GHC.Float.tanh}
GHC.Float.RealFloat{GHC.Float.atan2, GHC.Float.decodeFloat, GHC.Float.encodeFloat, GHC.Float.exponent, GHC.Float.floatDigits, GHC.Float.floatRadix, GHC.Float.floatRange, GHC.Float.isDenormalized, GHC.Float.isIEEE, GHC.Float.isInfinite, GHC.Float.isNaN, GHC.Float.isNegativeZero, GHC.Float.scaleFloat, GHC.Float.significand}
GHC.Integer.Type.Integer
GHC.IO.Exception.ioError
GHC.IO.Exception.IOError
GHC.IO.Exception.userError
GHC.IO.FilePath
GHC.Maybe.Maybe{GHC.Maybe.Just, GHC.Maybe.Nothing}
GHC.Num.Num{GHC.Num.*, GHC.Num.+, GHC.Num.-, GHC.Num.abs, GHC.Num.fromInteger, GHC.Num.negate, GHC.Num.signum}
GHC.Num.subtract
GHC.Read.lex
GHC.Read.Read{GHC.Read.readList, GHC.Read.readsPrec}
GHC.Read.readParen
GHC.Real.^
GHC.Real.^^
GHC.Real.Fractional{GHC.Real./, GHC.Real.fromRational, GHC.Real.recip}
GHC.Real.Integral{GHC.Real.div, GHC.Real.divMod, GHC.Real.mod, GHC.Real.quot, GHC.Real.quotRem, GHC.Real.rem, GHC.Real.toInteger}
GHC.Real.Rational
GHC.Real.Real{GHC.Real.toRational}
GHC.Real.RealFrac{GHC.Real.ceiling, GHC.Real.floor, GHC.Real.properFraction, GHC.Real.round, GHC.Real.truncate}
GHC.Real.realToFrac
GHC.Show.Show{GHC.Show.show, GHC.Show.showList, GHC.Show.showsPrec}
GHC.Show.showChar
GHC.Show.showParen
GHC.Show.shows
GHC.Show.ShowS
GHC.Show.showString
GHC.Types.Bool{GHC.Types.False, GHC.Types.True}
GHC.Types.Char
GHC.Types.Double
GHC.Types.Float
GHC.Types.Int
GHC.Types.IO
GHC.Types.Ordering{GHC.Types.EQ, GHC.Types.GT, GHC.Types.LT}
GHC.Types.Word
Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Documentation
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by David Eichmann
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information