Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (15 sloc) 550 Bytes
import qualified Data.ByteString.Lazy.Char8 as L
closing :: L.ByteString -> Maybe Int
closing = readPrice . (!!4) . L.split ','
readPrice :: L.ByteString -> Maybe Int
readPrice str =
case L.readInt str of
Nothing -> Nothing
Just (dollars, rest) ->
case L.readInt (L.tail rest) of
Nothing -> Nothing
Just (cents, _) -> Just (dollars * 100 + cents)
highestClose = maximum . (Nothing:) . map closing . L.lines
highestCloseFrom path = do
contents <- L.readFile path
print (highestClose contents)
Something went wrong with that request. Please try again.