hackernews

API for Hacker News

Version on this page:0.5.0.1
LTS Haskell 10.10:1.3.0.0
Stackage Nightly 2017-12-24:1.3.0.0
Latest on Hackage:1.4.0.0

See all snapshots hackernews appears in

MIT licensed by David Johnson
Maintained by [email protected]
This version can be pinned in stack with:hackernews-0.5.0.1@sha256:5d44753a28bcea42440f139d9c4737debafe6cfa8a07dbfa75570990f72a4c72,2536

Module documentation for 0.5.0.1

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)