remove overview.hs

This commit is contained in:
Simon Michael 2008-09-28 03:27:17 +00:00
parent 48c1a2ef99
commit 1421fb6b0b
2 changed files with 1 additions and 54 deletions

View File

@ -31,9 +31,6 @@ test:
docs haddock:
haddock -h -o doc *.hs
overview:
@./tools/overview.hs Types.hs >OVERVIEW
loc:
@darcs trackdown 'find . -name "*hs" |xargs wc -l |echo OUTPUT `tail -1`; false' |ruby -nae'puts $$F[1] if /^OUTPUT/'
@ -44,5 +41,5 @@ clean:
rm -f *.o *.hi *~ 1 2
Clean: clean
rm -f hledger hledgeropt overview TAGS tags
rm -f hledger hledgeropt TAGS tags

View File

@ -1,50 +0,0 @@
#!/usr/bin/env runhaskell
{-
overview.hs - print an overview of functions from a given list of modules
Simon Michael 2007
Usage: ./overview.hs somefile
where somefile, typically your main module, contains the word "overview"
followed by a blank-line-delimited list of module names, like so:
firstmodule
anothermodule
submodule
Useful for getting the big picture and refactoring.
-}
import System
import System.Process
import IO
import Data.List
import Text.Printf
main = do
args <- getArgs
file <- readFile $ head args
let mods = takeWhile ((> 0) . length) $
dropWhile ((== 0) . length) $
dropWhile ((> 0) . length) $
dropWhile (notElem "overview" . words) $
lines file
putStr $ unlines mods
let files = concat $ map ((++ ".hs ") . dropWhile (== ' ')) mods
let grep = "grep -H '^\\w[^=]*::' " ++ files
(inp, out, err, pid) <- runInteractiveCommand grep
waitForProcess pid
grepoutput <- hGetContents out
let groups = groupBy (\a b -> samefile a b) $ lines grepoutput
sequence $ map printgroup groups
putStr "\n"
printgroup ls = do putStr "\n"; sequence $ map printline ls
printline l =
putStrLn $ printf "%-22s %-40s %s" (file++":") code typedecl
where
(file, rest) = break (== ':') l
(code, typedecl) = break (== ':') $ tail rest
samefile a b = ((takeWhile (/= ':') a) ++ ":") `isPrefixOf` b