
18 Sep
2014
18 Sep
'14
6:23 p.m.
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} import Data.Aeson import GHC.Generics import qualified Data.ByteString.Lazy as B data Tweet = Tweet { id_str :: String, text :: String }deriving Generic instance FromJSON Tweet main = do input <- B.readFile "1.json" let mm = decode input :: Maybe Tweet case mm of Nothing -> print "error parsing JSON" Just m -> (putStrLn.greet) m greet m = (show.id_str) m This program is fine if 1.json file has 1 tweet if 1.json file has multiple tweets then it fails so how we can parse multiple tweets