|
definition: |
readModuleComment :: String -> IO String
readModuleComment filename = openFile filename ReadMode >>= readHeader []
where
readHeader cs h = do
eof <- hIsEOF h
if eof then hClose h >> return ""
else do l <- hGetLine h
case classifyLine l of
ModDef -> hClose h >> return (unlines (reverse cs))
FuncDef _ -> hClose h >> return "" -- no module header
DataDef _ -> hClose h >> return "" -- no module header
OtherLine -> readHeader cs h
Comment c -> readHeader (c:cs) h
|
|
demand: |
no demanded arguments |
|
deterministic: |
deterministic operation |
|
documentation: |
----------------------------------------------------------------------- Reads the module comment of a Curry source file. |
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_) |-> _}
|
|
name: |
readModuleComment |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
String -> Prelude.IO String |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |