[Xmonad] haddock documentation

Andrea Rossato mailing_list at istitutocolli.org
Wed Aug 22 11:45:48 EDT 2007


Hi,

since I'm going offline and I hope to come back and find a new XMonad
release, I'm sending the stuff I use to generate the documentation, so
that, if you release before my coming back, you can generate the
documentation by yourself.

Attached you'll find:

1. a patch to haddock (needed for the deriving clause of the X newtype)

2. a modified Setup.lhs with a haddock hook that will use the package
   description on the first page of the documentation

3. a cabal file with all the modules: the one I'm sending is updated
   to the last darcs version. I use the metamodule to get the list of
   modules.

That's it: 
runhaskell Setup.haddockHook.lhs haddock

Ciao
andrea
-------------- next part --------------

New patches:

[work around to parse "deriving" from parameterized types
Andrea Rossato <andrea.rossato at unibz.it>**20070610164400
 
   This is just a work around that will push the paramater (the type) as a
   class in the class list. I did a quick hack to parse XMonad source
   code...;-)
 
] {
hunk ./src/HsParser.ly 547
->	: dclasses ',' qtycls		{ $3 : $1 }
+>	: dclasses qtycls		{ $2 : $1 }
+>	| dclasses ',' qtycls		{ $3 : $1 }
}

Context:

[bug fix
Wolfgang Jeltsch <g9ks157k at acme.softbase.org>**20070419182340
 When Haddock was invoked with the --ignore-all-exports flag but the ignore-exports module attribute wasn't used, hyperlinks weren't created for non-exported names.
 
 This fix might not be as clean as one would wish (since --ignore-all-exports now results in ignore_all_exports = True *and* an additional OptIgnoreExports option for every module) but at least the bug seems to be resolved now.
] 
[URL expansion for %%, %L, %{LINE}
Roberto Zunino <zunrob at users.sf.net>**20070421023643] 
[Add a flag --allow-missing-html
Ian Lynagh <igloo at earth.li>**20070307145955
 With this flag, haddock ignores whether or not the HTML directory of
 packages depended upon exists. We need this when haddocking groups of
 packages that aren't installed yet.
] 
[Add a --ghc-pkg flag
Ian Lynagh <igloo at earth.li>**20070307144253] 
[added substitution %{FILE///c}
Conal Elliott <conal at conal.net>**20070214215400] 
[Do not create empty tables for data declarations which don't have any constructors, instances or comments. Gets better HTML 4.01 compliance
Neil Mitchell**20070206174912] 
[infix type op precedence tweak, ppHsNameAsVar 
Conal Elliott <conal at conal.net>**20070115171157] 
[tweaked tyvarop precedence
Conal Elliott <conal at conal.net>**20070110002300] 
[added infix type operators
Conal Elliott <conal at conal.net>**20070105172038] 
[Make the search box in a form so that enter does the default search
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070112125817] 
[Make the max number of results 75 instead of 50, to allow map searching in the base library to work
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070112122501] 
[Rewrite much of the index searching code, previously was too slow to execute on the base library with IE, the new version guarantees less than O(log n) operations be performed, where n is the number in the list (before was always O(n))
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070112121746] 
[Make the index be in case-insensitive alphabetic order
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111185143] 
[Change from tabs to spaces in the ppHtmlIndex function
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111182244] 
[Delete more stuff that is no longer required
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111182119] 
[Delete dead code, now there is only one index page
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111181746] 
[Add searching on the index page
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111170709] 
[Never do spliting index files into many
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111154115] 
[add test for blank lines inside @...@ code block
Simon Marlow <simonmar at microsoft.com>**20070109131444] 
[allow blank lines inside a @...@ code block
Simon Marlow <simonmar at microsoft.com>**20070109131434] 
[Fix up a case of extra vertical space after a code block
Simon Marlow <simonmar at microsoft.com>**20070105111341
 
 
] 
[TODO: do something better about re-exported symbols from another package
Simon Marlow <simonmar at microsoft.com>**20061215155200] 
[fix <<URL>> image markup
Simon Marlow <simonmar at microsoft.com>**20061208100637] 
[add todo item for --maintainer
Simon Marlow <simonmar at microsoft.com>**20061206160507] 
[fix --use-package error message
Simon Marlow <simonmar at microsoft.com>**20061013105135] 
[Cabal's sdist does not generate "-src.tar.gz" files, but ".tar.gz" ones
sven.panne at aedion.de**20061012152823] 
[Rename haddock.js to haddock-util.js
Simon Marlow <simonmar at microsoft.com>**20061011141737
 haddock.js will be run automatically by Windows when you type
 'haddock' if it is found on the PATH, so rename to avoid confusion.
 Spotted by Adrian Hey.
] 
[TAG 0.8 release
Simon Marlow <simonmar at microsoft.com>**20061010122403] 
Patch bundle hash:
045baf02257bddb4b1ea3e6bdc44dd71895d21e0
-------------- next part --------------
#!/usr/bin/env runhaskell

> import Distribution.Simple
> import Distribution.PackageDescription
> import Distribution.Setup
> import Distribution.Simple.Utils
> import Distribution.Simple.LocalBuildInfo
> import Distribution.Program
> import Distribution.PreProcess

> import System.FilePath.Posix
> import System.Directory
> import Data.List


> main = defaultMainWithHooks defaultUserHooks {haddockHook = xmonadHaddock}

> -- a different implementation of haddock hook from
> -- from Distribution.Simple: will use synopsis and description for 
> -- building executables' documentation.

> xmonadHaddock pkg_descr lbi hooks (HaddockFlags hoogle verbose) = do
>   confHaddock <- do let programConf = withPrograms lbi
>                         haddockName = programName haddockProgram
>                     mHaddock <- lookupProgram haddockName programConf
>                     maybe (die "haddock command not found") return mHaddock

>   let tmpDir = (buildDir lbi) </> "tmp"
>   createDirectoryIfMissing True tmpDir
>   createDirectoryIfMissing True haddockPref
>   preprocessSources pkg_descr lbi verbose (allSuffixHandlers hooks)
>   setupMessage "Running Haddock for" pkg_descr

>   let outputFlag  = if hoogle then "--hoogle" else "--html"
>       showPkg     = showPackageId (package pkg_descr)
>       showDepPkgs = map showPackageId (packageDeps lbi)
                          
>   withExe pkg_descr $ \exe -> do 
>     let bi = buildInfo exe
>     inFiles <- getModulePaths bi (otherModules bi)
>     srcMainPath <- findFile (hsSourceDirs bi) (modulePath exe)

>     let prologName = showPkg ++ "-haddock-prolog.txt"
>     writeFile prologName (description pkg_descr ++ "\n")

>     let exeTargetDir = haddockPref </> exeName exe
>         outFiles = srcMainPath : inFiles
>         haddockFile = exeTargetDir </> (haddockName pkg_descr)

>     createDirectoryIfMissing True exeTargetDir
>     rawSystemProgram verbose confHaddock
>                          ([outputFlag,
>                            "--odir=" ++ exeTargetDir,
>                            "--title=" ++ showPkg ++ ": " ++ synopsis pkg_descr,
>                            "--package=" ++ showPkg,
>                            "--dump-interface=" ++ haddockFile,
>                            "--prologue=" ++ prologName
>                           ]
>                           ++ map ("--use-package=" ++) showDepPkgs
>                           ++ programArgs confHaddock
>                           ++ (if verbose > 4 then ["--verbose"] else [])
>                           ++ outFiles
>                          )
>     removeFile prologName
  
> getModulePaths :: BuildInfo -> [String] -> IO [FilePath]
> getModulePaths bi =
>    fmap concat .
>       mapM (flip (moduleToFilePath (hsSourceDirs bi)) ["hs", "lhs"])
    

> allSuffixHandlers :: Maybe UserHooks
>                   -> [PPSuffixHandler]
> allSuffixHandlers hooks
>     = maybe knownSuffixHandlers
>       (\h -> overridesPP (hookedPreProcessors h) knownSuffixHandlers)
>       hooks
>     where
>       overridesPP :: [PPSuffixHandler] -> [PPSuffixHandler] -> [PPSuffixHandler]
>       overridesPP = unionBy (\x y -> fst x == fst y)
-------------- next part --------------
name:               xmonad
version:            0.2
homepage:           http://xmonad.org
synopsis:           A lightweight X11 window manager.
description:
    Xmonad is a minimalist tiling window manager for X, written in
    Haskell. Windows are managed using automatic layout algorithms,
    which can be dynamically reconfigured. At any time windows are
    arranged so as to maximise the use of screen real estate. All
    features of the window manager are accessible purely from the
    keyboard: a mouse is entirely optional.  Xmonad is configured in
    Haskell, and custom layout algorithms may be implemented by the user
    in config files. A principle of Xmonad is predictability: the user
    should know in advance precisely the window arrangement that will
    result from any action.
category:           System
license:            BSD3
license-file:       LICENSE
author:             Spencer Janssen
maintainer:         sjanssen at cse.unl.edu
build-depends:      base>=2.0, X11>=1.2.1, X11-extras>=0.2, mtl>=1.0, unix>=1.0, readline >= 1.0, network
extra-source-files: README TODO tests/loc.hs tests/Properties.hs man/xmonad.1.in
                    Config.hs-boot util/GenerateManpage.hs man/xmonad.1 man/xmonad.html


executable:         xmonad
main-is:            Main.hs
other-modules:      Config Operations StackSet XMonad XMonadContrib.Accordion XMonadContrib.Anneal XMonadContrib.Circle XMonadContrib.Commands XMonadContrib.Combo XMonadContrib.CopyWindow XMonadContrib.Decoration XMonadContrib.DeManage XMonadContrib.DirectoryPrompt XMonadContrib.Dmenu XMonadContrib.DragPane XMonadContrib.DwmPromote XMonadContrib.DynamicLog XMonadContrib.DynamicWorkspaces XMonadContrib.Dzen XMonadContrib.FindEmptyWorkspace XMonadContrib.FlexibleResize XMonadContrib.FlexibleManipulate XMonadContrib.FocusNth XMonadContrib.HintedTile XMonadContrib.LayoutHelpers XMonadContrib.LayoutHints XMonadContrib.LayoutHooks XMonadContrib.LayoutScreens XMonadContrib.MagicFocus XMonadContrib.Magnifier XMonadContrib.Mosaic XMonadContrib.MouseFocus XMonadContrib.NamedWindows XMonadContrib.NoBorders XMonadContrib.Roledex XMonadContrib.RotSlaves XMonadContrib.RotView XMonadContrib.ShellPrompt XMonadContrib.SimpleDate XMonadContrib.SimpleStacking XMonadContrib.SinkAll XMonadContrib.Spiral XMonadContrib.Square XMonadContrib.SshPrompt XMonadContrib.Submap XMonadContrib.SwitchTrans XMonadContrib.Tabbed XMonadContrib.ThreeColumns XMonadContrib.TwoPane XMonadContrib.ViewPrev XMonadContrib.XMonadPrompt XMonadContrib.XPrompt XMonadContrib.Warp XMonadContrib.WorkspaceDir
ghc-options:        -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s
ghc-prof-options:   -prof -auto-all
extensions:         GeneralizedNewtypeDeriving




More information about the Xmonad mailing list