Refactor getSeparator

This commit is contained in:
Aleksandar Dimitrov 2020-01-05 21:08:41 +01:00 committed by Simon Michael
parent 92f680875f
commit 9011aaa5ba

View File

@ -115,9 +115,7 @@ parseSeparator = specials . map toLower
-- | Decide which separator to get. -- | Decide which separator to get.
-- If the external separator is provided, take it. Otherwise, look at the rules. Finally, return ','. -- If the external separator is provided, take it. Otherwise, look at the rules. Finally, return ','.
getSeparator :: CsvRules -> Char getSeparator :: CsvRules -> Char
getSeparator rules = head $ getSeparator rules = maybe ',' id (getDirective "separator" rules >>= parseSeparator)
catMaybes [ getDirective "separator" rules >>= parseSeparator
, Just ',']
-- | Read a Journal from the given CSV data (and filename, used for error -- | Read a Journal from the given CSV data (and filename, used for error
-- messages), or return an error. Proceed as follows: -- messages), or return an error. Proceed as follows: