
6 Feb
2009
6 Feb
'09
5:30 a.m.
Magnus Therning wrote: [...]
isSection line = not . isSpace . head $ line
In this particular case I would use: isSection = null . takeWhile isSpace
Prelude.head: empty list see also http://haskell.org/haskellwiki/Haskell_programming_tips#Partial_functions_li...
Another course of action would be to add exception handling; if head throws an exception then the input file isn't following the accepted syntax.
I'ld rather check all lines before (or filter non empty ones) than trying to catch Prelude.head: empty list! C.