on 0.11.1.4 help sign in
74 lines 2.0 kB history raw
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.
11{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
13module Twitter (
14 Metadata(..)
15 , Geo(..)
16 , Story(..)
17 , Result(..)
18 ) where
20import Data.Data (Typeable, Data)
21import Data.Int (Int64)
22import Data.Text (Text)
23-- import Data.Time (ZonedTime)
24import GHC.Generics (Generic)
25import Prelude hiding (id)
26import Control.DeepSeq
28data Metadata = Metadata {
29 result_type :: Text
30 } deriving (Eq, Show, Typeable, Data, Generic)
32instance NFData Metadata
34data Geo = Geo {
35 type_ :: Text
36 , coordinates :: (Double, Double)
37 } deriving (Eq, Show, Typeable, Data, Generic)
39instance NFData Geo
41data Story = Story {
42 from_user_id_str :: Text
43 , profile_image_url :: Text
44 , created_at :: Text -- ZonedTime
45 , from_user :: Text
46 , id_str :: Text
47 , metadata :: Metadata
48 , to_user_id :: Maybe Int64
49 , text :: Text
50 , id :: Int64
51 , from_user_id :: Int64
52 , geo :: Maybe Geo
53 , iso_language_code :: Text
54 , to_user_id_str :: Maybe Text
55 , source :: Text
56 } deriving (Show, Typeable, Data, Generic)
58instance NFData Story
60data Result = Result {
61 results :: [Story]
62 , max_id :: Int64
63 , since_id :: Int64
64 , refresh_url :: Text
65 , next_page :: Text
66 , results_per_page :: Int
67 , page :: Int
68 , completed_in :: Double
69 , since_id_str :: Text
70 , max_id_str :: Text
71 , query :: Text
72 } deriving (Show, Typeable, Data, Generic)
74instance NFData Result