1-- These types follow the format of Twitter search results, as can be 2-- found in the benchmarks/json-data directory. 3-- 4-- For uses of these types, see the Twitter subdirectory. 5-- 6-- There is one deviation for the sake of convenience: the Geo field 7-- named "type_" is really named "type" in Twitter's real feed. I 8-- renamed "type" to "type_" in the *.json files, to avoid overlap 9-- with a Haskell reserved keyword. 10 11{-# LANGUAGE DeriveDataTypeable #-} 12{-# LANGUAGE DeriveGeneric #-} 13{-# LANGUAGE NoImplicitPrelude #-} 14 15module Twitter 16 ( 17 Metadata(..) 18 , Geo(..) 19 , Story(..) 20 , Result(..) 21 ) where 22 23import Prelude.Compat 24 25import Control.DeepSeq 26import Data.Data (Typeable, Data) 27import Data.Int (Int64) 28import Data.Text (Text) 29import GHC.Generics (Generic) 30 31{-# ANN module "Hlint: ignore Use camelCase" #-} 32{-# ANN module "Hlint: ignore Use newtype instead of data" #-} 33 34data Metadata = Metadata { 35 result_type :: Text 36 } deriving (Eq, Show, Typeable, Data, Generic) 37 38instance NFData Metadata 39 40data Geo = Geo { 41 type_ :: Text 42 , coordinates :: (Double, Double) 43 } deriving (Eq, Show, Typeable, Data, Generic) 44 45instance NFData Geo 46 47data Story = Story { 48 from_user_id_str :: Text 49 , profile_image_url :: Text 50 , created_at :: Text -- ZonedTime 51 , from_user :: Text 52 , id_str :: Text 53 , metadata :: Metadata 54 , to_user_id :: Maybe Int64 55 , text :: Text 56 , id_ :: Int64 57 , from_user_id :: Int64 58 , geo :: Maybe Geo 59 , iso_language_code :: Text 60 , to_user_id_str :: Maybe Text 61 , source :: Text 62 } deriving (Show, Typeable, Data, Generic) 63 64instance NFData Story 65 66data Result = Result { 67 results :: [Story] 68 , max_id :: Int64 69 , since_id :: Int64 70 , refresh_url :: Text 71 , next_page :: Text 72 , results_per_page :: Int 73 , page :: Int 74 , completed_in :: Double 75 , since_id_str :: Text 76 , max_id_str :: Text 77 , query :: Text 78 } deriving (Show, Typeable, Data, Generic) 79 80instance NFData Result 81