Created
December 16, 2019 15:43
-
-
Save yasar11732/f766cdd46995c74d0f16ce49bcad860e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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