hackernews: API for Hacker News

[ library, mit, program, web ] [ Propose Tags ]

API for news.ycombinator.com


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.0.1, 0.2.0.1, 0.2.1.1, 0.2.2.1, 0.2.2.2, 0.2.3.2, 0.3.0.0, 0.3.1.0, 0.3.1.1, 0.3.1.2, 0.4.0.0, 0.5.0.0, 0.5.0.1, 1.0.0.0, 1.1.0.0, 1.1.1.0, 1.1.2.0, 1.2.0.0, 1.3.0.0, 1.4.0.0
Dependencies aeson (>=0.8.0.1), attoparsec (>=0.12.1.2), base (==4.*), bytestring (>=0.10.4.0), either (>=4.3.1), ghcjs-base, HsOpenSSL (>=0.10.5), http-streams (>=0.7.2.2), io-streams (>=1.1.4.6), text (>=1.2.0.0), time (>=1.4.2), transformers (>=0.3.0.0) [details]
License MIT
Author David Johnson
Maintainer djohnson.m@gmail.com
Category Web
Source repo head: git clone https://github.com/dmjio/hackernews
Uploaded by DavidJohnson at 2015-09-25T03:45:18Z
Distributions NixOS:1.4.0.0
Downloads 12685 total (70 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2015-09-25 [all 1 reports]

Modules

[Index]

Flags

NameDescriptionDefaultType
ghcjs

Tell cabal we're using GHCJS

DisabledAutomatic

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hackernews-0.5.0.1

[back to package description]

hackernews

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build Status

Hacker News API for Haskell

###Documentation https://github.com/HackerNews/API

Now it supports GHCJS and can be used in the browser! Just install it using:

cabal install --ghcjs --flags=ghcjs

###Tests

cabal configure && cabal test
Hacker News API Tests
  - Retrieves a Story
  - Retrieves a Comment
  - Retrieves a User
  - Retrieves a Poll
  - Retrieves a Pollopt
  - Retrieves Top Stories
  - Retrieves Max Item
  - Retrieves Updates

Finished in 0.0019 seconds
8 examples, 0 failures

###Usage

module Example where

import           Control.Monad  (liftM3)
import           Web.HackerNews (UserId (..), getUser, hackerNews)

main :: IO ()
main = print =<< hackerNews (liftM3 (,,) one two three)
  where
    one   = getUser (UserId "dmjio")
    two   = getUser (UserId "dmj")
    three = getUser (UserId "abs")
(Just (User { userAbout = Nothing
            , userCreated = 2013-08-06 16:49:23 UTC
            , userDelay = 0
            , userId = UserId "dmjio"
            , userKarma = 6
            , userSubmitted = [8433827,8429256,8429161,8429069,8374809,8341570,7919268,7825469,7350544,7327291,6495994,6352317,6168527,6168524,6167639]})
      , 
Just (User { userAbout = Nothing
           , userCreated = 2007-04-11 05:57:35 UTC
           , userDelay = 0
           , userId = UserId "dmj"
           , userKarma = 1
           , userSubmitted = [11737]
           }),
Nothing)