hackernews 0.2.0.1 → 0.2.1.1
raw patch · 6 files changed
+54/−41 lines, 6 filesdep ~hspecPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: hspec
API changes (from Hackage documentation)
+ Web.HackerNews: commentDeleted :: Comment -> Bool
+ Web.HackerNews: pollDeleted :: Poll -> Bool
+ Web.HackerNews: pollOptDeleted :: PollOpt -> Bool
+ Web.HackerNews: storyDeleted :: Story -> Bool
+ Web.HackerNews: updateDeleted :: Update -> Bool
- Web.HackerNews: Comment :: Text -> CommentId -> Maybe [Int] -> Int -> Text -> UTCTime -> Text -> Comment
+ Web.HackerNews: Comment :: Text -> CommentId -> Maybe [Int] -> Int -> Text -> UTCTime -> Text -> Bool -> Comment
- Web.HackerNews: Poll :: Text -> PollId -> [Int] -> [Int] -> Int -> Text -> UTCTime -> Text -> Text -> Poll
+ Web.HackerNews: Poll :: Text -> PollId -> [Int] -> [Int] -> Int -> Text -> UTCTime -> Text -> Text -> Bool -> Poll
- Web.HackerNews: PollOpt :: Text -> PollOptId -> Int -> Int -> Text -> UTCTime -> Text -> PollOpt
+ Web.HackerNews: PollOpt :: Text -> PollOptId -> Int -> Int -> Text -> UTCTime -> Text -> Bool -> PollOpt
- Web.HackerNews: Story :: Text -> Int -> [Int] -> Int -> UTCTime -> Text -> Text -> Text -> Story
+ Web.HackerNews: Story :: Text -> Int -> [Int] -> Int -> UTCTime -> Text -> Text -> Text -> Bool -> Story
- Web.HackerNews: Update :: [Int] -> [Text] -> Update
+ Web.HackerNews: Update :: [Int] -> [Text] -> Bool -> Update
Files
- hackernews.cabal +2/−1
- src/Web/HackerNews/Comment.hs +3/−1
- src/Web/HackerNews/Person.hs +13/−11
- src/Web/HackerNews/Poll.hs +22/−18
- src/Web/HackerNews/Story.hs +11/−9
- src/Web/HackerNews/Update.hs +3/−1
hackernews.cabal view
@@ -1,5 +1,5 @@ name: hackernews-version: 0.2.0.1+version: 0.2.1.1 description: API for news.ycombinator.com license: MIT synopsis: API for Hacker News@@ -43,6 +43,7 @@ build-depends: base , hackernews , hspec+ , hspec >= 1.11.4 , hspec >= 1.11.4 , transformers default-language: Haskell2010
src/Web/HackerNews/Comment.hs view
@@ -4,7 +4,7 @@ import Control.Applicative ((<$>), (<*>)) import Control.Monad (MonadPlus (mzero)) import Data.Aeson (FromJSON (parseJSON), Value (Object),- (.:), (.:?))+ (.:), (.:?), (.!=)) import Data.Text (Text) import Data.Time (UTCTime) @@ -20,6 +20,7 @@ , commentText :: Text , commentTime :: UTCTime , commentType :: Text+ , commentDeleted :: Bool } deriving Show newtype CommentId@@ -37,6 +38,7 @@ <*> o .: "text" <*> (fromSeconds <$> o .: "time") <*> o .: "type"+ <*> o .:? "deleted" .!= False parseJSON _ = mzero
src/Web/HackerNews/Person.hs view
@@ -1,10 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} module Web.HackerNews.Person where -import Control.Applicative ((<*>), (<$>))+import Control.Applicative ((<$>), (<*>)) import Control.Monad (MonadPlus (mzero)) import Data.Aeson (FromJSON (parseJSON), Value (Object),- (.:), (.:?))+ (.:), (.:?), (.!=)) import Data.Text (Text) import Data.Time (UTCTime) @@ -13,14 +13,15 @@ ------------------------------------------------------------------------------ -- | Types data Person = Person {- personBy :: Text- , personId :: PersonId- , personKids :: Maybe [Int]- , personScore :: Maybe Int- , personTime :: UTCTime- , personTitle :: Maybe Text- , personType :: Text- , personUrl :: Maybe Text+ personBy :: Text+ , personId :: PersonId+ , personKids :: Maybe [Int]+ , personScore :: Maybe Int+ , personTime :: UTCTime+ , personTitle :: Maybe Text+ , personType :: Text+ , personUrl :: Maybe Text+ , personDeleted :: Bool } deriving (Show, Eq) newtype PersonId@@ -39,4 +40,5 @@ <*> o .:? "title" <*> o .: "type" <*> o .:? "url"- parseJSON _ = mzero + <*> o .:? "deleted" .!= False+ parseJSON _ = mzero
src/Web/HackerNews/Poll.hs view
@@ -1,10 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} module Web.HackerNews.Poll where -import Control.Applicative ((<*>), (<$>))+import Control.Applicative ((<$>), (<*>)) import Control.Monad (MonadPlus (mzero)) import Data.Aeson (FromJSON (parseJSON), Value (Object),- (.:))+ (.:), (.!=), (.:?)) import Data.Text (Text) import Data.Time (UTCTime) @@ -13,25 +13,27 @@ ------------------------------------------------------------------------------ -- | Types data Poll = Poll {- pollBy :: Text- , pollId :: PollId- , pollKids :: [Int]- , pollParts :: [Int]- , pollScore :: Int- , pollText :: Text- , pollTime :: UTCTime- , pollTitle :: Text- , pollType :: Text+ pollBy :: Text+ , pollId :: PollId+ , pollKids :: [Int]+ , pollParts :: [Int]+ , pollScore :: Int+ , pollText :: Text+ , pollTime :: UTCTime+ , pollTitle :: Text+ , pollType :: Text+ , pollDeleted :: Bool } deriving (Show, Eq) data PollOpt = PollOpt {- pollOptBy :: Text- , pollOptId :: PollOptId- , pollOptParent :: Int- , pollOptScore :: Int- , pollOptText :: Text- , pollOptTime :: UTCTime- , pollOptType :: Text+ pollOptBy :: Text+ , pollOptId :: PollOptId+ , pollOptParent :: Int+ , pollOptScore :: Int+ , pollOptText :: Text+ , pollOptTime :: UTCTime+ , pollOptType :: Text+ , pollOptDeleted :: Bool } deriving (Show, Eq) newtype PollOptId@@ -55,6 +57,7 @@ <*> (fromSeconds <$> o .: "time") <*> o .: "title" <*> o .: "type"+ <*> o .:? "deleted" .!= False parseJSON _ = mzero instance FromJSON PollOpt where@@ -66,4 +69,5 @@ <*> o .: "text" <*> (fromSeconds <$> o .: "time") <*> o .: "type"+ <*> o .:? "deleted" .!= False parseJSON _ = mzero
src/Web/HackerNews/Story.hs view
@@ -4,7 +4,7 @@ import Control.Applicative ((<$>), (<*>)) import Control.Monad (MonadPlus (mzero)) import Data.Aeson (FromJSON (parseJSON), Value (Object),- (.:))+ (.:), (.!=), (.:?)) import Data.Text (Text) import Data.Time (UTCTime) @@ -13,14 +13,15 @@ ------------------------------------------------------------------------------ -- | Types data Story = Story {- storyBy :: Text- , storyId :: Int- , storyKids :: [Int]- , storyScore :: Int- , storyTime :: UTCTime- , storyTitle :: Text- , storyType :: Text- , storyUrl :: Text+ storyBy :: Text+ , storyId :: Int+ , storyKids :: [Int]+ , storyScore :: Int+ , storyTime :: UTCTime+ , storyTitle :: Text+ , storyType :: Text+ , storyUrl :: Text+ , storyDeleted :: Bool } deriving Show newtype StoryId@@ -42,5 +43,6 @@ <*> o .: "title" <*> o .: "type" <*> o .: "url"+ <*> o .:? "deleted" .!= False parseJSON _ = mzero
src/Web/HackerNews/Update.hs view
@@ -4,7 +4,7 @@ import Control.Applicative ((<$>), (<*>)) import Control.Monad (MonadPlus (mzero)) import Data.Aeson (FromJSON (parseJSON), Value (Object),- (.:))+ (.:), (.!=), (.:?)) import Data.Text (Text) ------------------------------------------------------------------------------@@ -12,6 +12,7 @@ data Update = Update { updateItems :: [Int] , updateProfiles :: [Text]+ , updateDeleted :: Bool } deriving (Show, Eq) ------------------------------------------------------------------------------@@ -20,5 +21,6 @@ parseJSON (Object o) = Update <$> o .: "items" <*> o .: "profiles"+ <*> o .:? "deleted" .!= False parseJSON _ = mzero