Copyright | (c) David Johnson, Konstantin Zudov, 2014 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- hackerNews :: FromJSON a => HackerNews a -> IO (Either HackerNewsError a)
- getItem :: ItemId -> HackerNews Item
- getStory :: StoryId -> HackerNews Story
- getComment :: CommentId -> HackerNews Comment
- getPoll :: PollId -> HackerNews Poll
- getPollOpt :: PollOptId -> HackerNews PollOpt
- getUser :: UserId -> HackerNews User
- getJob :: JobId -> HackerNews Job
- getTopStories :: HackerNews TopStories
- getMaxItem :: HackerNews MaxItem
- getUpdates :: HackerNews Update
- type HackerNews a = EitherT HackerNewsError (ReaderT Connection IO) a
- data HackerNewsError
- data Item
- newtype ItemId = ItemId Int
- data Comment = Comment {
- commentBy :: Text
- commentId :: CommentId
- commentKids :: Maybe [Int]
- commentParent :: Int
- commentText :: Text
- commentTime :: UTCTime
- commentType :: Text
- commentDeleted :: Bool
- commentDead :: Bool
- newtype CommentId = CommentId Int
- data Poll = Poll {}
- newtype PollId = PollId Int
- data PollOpt = PollOpt {
- pollOptBy :: Text
- pollOptId :: PollOptId
- pollOptParent :: Int
- pollOptScore :: Int
- pollOptText :: Text
- pollOptTime :: UTCTime
- pollOptType :: Text
- pollOptDeleted :: Bool
- pollOptDead :: Bool
- newtype PollOptId = PollOptId Int
- data Story = Story {}
- newtype StoryId = StoryId Int
- data User = User {}
- newtype UserId = UserId Text
- data Job = Job {}
- newtype JobId = JobId Int
- data Update = Update {
- updateItems :: [Int]
- updateProfiles :: [Text]
- updateDeleted :: Bool
- updateDead :: Bool
- newtype MaxItem = MaxItem Int
- newtype TopStories = TopStories [Int]
Hacker News Monad
hackerNews :: FromJSON a => HackerNews a -> IO (Either HackerNewsError a) Source
HackerNews API request method
API Calls
getJob :: JobId -> HackerNews Job Source
Retrieve a Job
getTopStories :: HackerNews TopStories Source
Retrieve the Top Stories on Hacker News
getMaxItem :: HackerNews MaxItem Source
Retrieve the largest ItemId
getUpdates :: HackerNews Update Source
Retrieve the latest updates
Types
type HackerNews a = EitherT HackerNewsError (ReaderT Connection IO) a Source
Core Type
data HackerNewsError Source
Error Types
Item Type
Comment Object
Comment | |
|
Poll Object
Poll Opt Object
PollOpt | |
|
Story Object
Types
Update Object
Update | |
|
Max Item Int
newtype TopStories Source
TopStories List
Eq TopStories | |
Show TopStories | |
FromJSON TopStories | JSON instances |