File: GenHaddock.hs

package info (click to toggle)
lambdabot 5.3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 336 kB
  • sloc: haskell: 93; sh: 36; makefile: 7
file content (15 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--
-- | Generate the initial @index state
--
import Text.HTML.TagSoup
import Data.List

main = interact (unlines . go [] . parseTags)

go mods (TagOpen "td" [("class","src")] : TagText ident : xs) =
    nub mods ++ ["" | not (null mods)] ++ ident : go [] xs
go mods (TagOpen "td" [("class","module")] : xs) =
    let (ys, zs) = span (not . isTagCloseName "td") xs in
    go (mods ++ words (filter (/= ',') (innerText ys))) zs
go mods (x : xs) = go mods xs
go mods [] = nub mods ++ ["" | not (null mods)]