diff options
author | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-09-22 23:40:00 +0200 |
---|---|---|
committer | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-09-23 00:10:07 +0200 |
commit | ca8439b6787eb238d7b07544dfc728488f3c71b6 (patch) | |
tree | 0f812affaa5c569248ee2c1c7e8b39c6e8a405c7 /Notmuch | |
parent | 121d703bcd3ecbaba031499070907251b5eae1a9 (diff) |
lint
Diffstat (limited to 'Notmuch')
-rw-r--r-- | Notmuch/Message.hs | 6 | ||||
-rw-r--r-- | Notmuch/SearchResult.hs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Notmuch/Message.hs b/Notmuch/Message.hs index d0bb788..d08be39 100644 --- a/Notmuch/Message.hs +++ b/Notmuch/Message.hs @@ -102,7 +102,7 @@ instance FromJSON Message where <*> v .: "tags" <*> v .: "filename" parseJSON (Array _) = return $ Message (MessageID "") defTime M.empty [] True False [] "" - where defTime = UTCTime (ModifiedJulianDay 0) (fromInteger 0) + where defTime = UTCTime (ModifiedJulianDay 0) 0 parseJSON x = fail $ "Error parsing message: " ++ show x hasTag :: T.Text -> Message -> Bool @@ -110,10 +110,10 @@ hasTag tag = (tag `elem`) . messageTags -data Thread = Thread { threadForest :: TR.Forest Message } +newtype Thread = Thread { threadForest :: TR.Forest Message } instance FromJSON Thread where - parseJSON (Array vs) = Thread <$> (mapM parseTree $ V.toList vs) + parseJSON (Array vs) = Thread <$> mapM parseTree (V.toList vs) parseJSON _ = fail "Thread is not an array" parseTree :: Value -> Parser (TR.Tree Message) diff --git a/Notmuch/SearchResult.hs b/Notmuch/SearchResult.hs index 94bfecf..a59fa9c 100644 --- a/Notmuch/SearchResult.hs +++ b/Notmuch/SearchResult.hs @@ -38,7 +38,7 @@ instance HasNotmuchId SearchResult where instance FromJSON SearchResult where - parseJSON (Object v) = SearchResult <$> ((ThreadID . ("thread:"++)) <$> v .: "thread") + parseJSON (Object v) = SearchResult <$> (ThreadID . ("thread:"++) <$> v .: "thread") <*> (posixSecondsToUTCTime . fromInteger <$> v .: "timestamp") <*> v .: "date_relative" <*> v .:? "subject" .!= "" |