-
-
Save tmcw/243c7a267142862e4c1de7dd124aabb8 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
{-# LANGUAGE DeriveGeneric, OverloadedStrings #-} | |
import GHC.Generics | |
import System.Directory | |
import System.IO | |
import Prelude | |
import Data.Either | |
import Data.Aeson | |
import qualified Data.ByteString.Lazy as B | |
{- data Chart = | |
Chart (Array Entry) deriving (Show, Generic) -} | |
data Entry = | |
Entry { artist :: !String | |
, change :: !String | |
} deriving (Show, Generic) | |
instance FromJSON Entry | |
instance ToJSON Entry | |
readAndParse :: FilePath -> IO () | |
readAndParse filePath = | |
case (eitherDecode <$> B.readFile filePath) of | |
Left val -> print "yes" | |
Right err -> print "no" | |
main = do | |
fileList <- getDirectoryContents "./charts" | |
(map readAndParse fileList) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment