Skip to content

Instantly share code, notes, and snippets.

@yasar11732
Created December 16, 2019 15:43
Show Gist options
  • Save yasar11732/f766cdd46995c74d0f16ce49bcad860e to your computer and use it in GitHub Desktop.
Save yasar11732/f766cdd46995c74d0f16ce49bcad860e to your computer and use it in GitHub Desktop.
module HighestClose where
import qualified Data.ByteString.Lazy.Char8 as L
closing = readPrice . (!!7) . L.split ';'
readPrice :: L.ByteString -> Maybe Int
readPrice str = do
(tl,rest) <- L.readInt str
case rest of
L.empty -> Nothing
_ -> do
(kurus,more) <- L.readInt (L.tail rest)
return (tl * 100 + kurus)
highestClose = maximum . (Nothing:) . map closing . L.lines
highestCloseFrom path = do
contents <- L.readFile path
print (highestClose contents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment