4r-api: Add Eq and Hashable instances to request types
parent
7087b89316
commit
774783634d
|
@ -19,6 +19,11 @@ import Data.HashMap.Strict qualified as M
|
||||||
import Web.FormUrlEncoded (Form (Form), ToForm (toForm))
|
import Web.FormUrlEncoded (Form (Form), ToForm (toForm))
|
||||||
|
|
||||||
data GetSections = GetSections
|
data GetSections = GetSections
|
||||||
|
deriving stock (Eq)
|
||||||
|
|
||||||
|
instance Hashable GetSections where
|
||||||
|
hashWithSalt = const
|
||||||
|
|
||||||
instance ToForm GetSections where
|
instance ToForm GetSections where
|
||||||
toForm GetSections = Form $ M.fromList [("type", ["sections"]), ("key", ["anon"])]
|
toForm GetSections = Form $ M.fromList [("type", ["sections"]), ("key", ["anon"])]
|
||||||
|
|
||||||
|
@ -31,6 +36,11 @@ instance NFData Section
|
||||||
instance FromJSON Section
|
instance FromJSON Section
|
||||||
|
|
||||||
data GetTopics = GetTopics
|
data GetTopics = GetTopics
|
||||||
|
deriving stock (Eq)
|
||||||
|
|
||||||
|
instance Hashable GetTopics where
|
||||||
|
hashWithSalt = const
|
||||||
|
|
||||||
instance ToForm GetTopics where
|
instance ToForm GetTopics where
|
||||||
toForm GetTopics = Form $ M.fromList [("type", ["threads"]), ("key", ["anon"])]
|
toForm GetTopics = Form $ M.fromList [("type", ["threads"]), ("key", ["anon"])]
|
||||||
|
|
||||||
|
@ -42,7 +52,10 @@ data TopicInfo = TopicInfo
|
||||||
instance NFData TopicInfo
|
instance NFData TopicInfo
|
||||||
instance FromJSON TopicInfo
|
instance FromJSON TopicInfo
|
||||||
|
|
||||||
data GetTopic = GetTopic {topic_id :: Integer}
|
newtype GetTopic = GetTopic {topic_id :: Integer}
|
||||||
|
deriving stock (Eq)
|
||||||
|
deriving newtype (Hashable)
|
||||||
|
|
||||||
instance ToForm GetTopic where
|
instance ToForm GetTopic where
|
||||||
toForm GetTopic{topic_id} =
|
toForm GetTopic{topic_id} =
|
||||||
Form $
|
Form $
|
||||||
|
|
Loading…
Reference in New Issue