3 -- Copyright : (c) 2008 Bertram Felgenhauer
6 -- Maintainer : Bertram Felgenhauer <int-e@gmx.de>
7 -- Stability : experimental
8 -- Portability : portable
10 -- This module is part of Haskell PGMS.
19 import System
.Directory
23 findFile
:: FilePath -> IO FilePath
25 let scan
:: [IO FilePath] -> IO FilePath
26 scan
[] = error $ "Couldn't find file '" ++ name
++ "'"
30 if b
then return f
else scan cs
31 scan
[getDataFileName name
,
32 return $ "data/" ++ name
,
33 return $ "../data/" ++ name
,
36 formatString
:: String -> String
37 formatString
= unlines . concatMap (block
. (++" ")) . intersperse "" . lines
41 (chunk
, rest
) = splitAt 78 text
42 (end
', start
') = span
(not . isSpace) (reverse chunk
)
44 if null start
' then chunk
: block
(dropWhile isSpace rest
)
45 else reverse (dropWhile isSpace start
')
46 : block
(reverse end
' ++ rest
)