on 1.1.1.0 help sign in
78 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 #-}
12{-# LANGUAGE DeriveGeneric #-}
14module Twitter
15 (
16 Metadata(..)
17 , Geo(..)
18 , Story(..)
19 , Result(..)
20 ) where
22import Prelude ()
23import Prelude.Compat
25import Control.DeepSeq
26import Data.Data (Typeable, Data)
27import Data.Int (Int64)
28import Data.Text (Text)
29import GHC.Generics (Generic)
30import Prelude hiding (id)
32data Metadata = Metadata {
33 result_type :: Text
34 } deriving (Eq, Show, Typeable, Data, Generic)
36instance NFData Metadata
38data Geo = Geo {
39 type_ :: Text
40 , coordinates :: (Double, Double)
41 } deriving (Eq, Show, Typeable, Data, Generic)
43instance NFData Geo
45data Story = Story {
46 from_user_id_str :: Text
47 , profile_image_url :: Text
48 , created_at :: Text -- ZonedTime
49 , from_user :: Text
50 , id_str :: Text
51 , metadata :: Metadata
52 , to_user_id :: Maybe Int64
53 , text :: Text
54 , id_ :: Int64
55 , from_user_id :: Int64
56 , geo :: Maybe Geo
57 , iso_language_code :: Text
58 , to_user_id_str :: Maybe Text
59 , source :: Text
60 } deriving (Show, Typeable, Data, Generic)
62instance NFData Story
64data Result = Result {
65 results :: [Story]
66 , max_id :: Int64
67 , since_id :: Int64
68 , refresh_url :: Text
69 , next_page :: Text
70 , results_per_page :: Int
71 , page :: Int
72 , completed_in :: Double
73 , since_id_str :: Text
74 , max_id_str :: Text
75 , query :: Text
76 } deriving (Show, Typeable, Data, Generic)
78instance NFData Result