packages feed

hackernews 0.3.1.0 → 0.3.1.1

raw patch · 2 files changed

+14/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hackernews.cabal view
@@ -1,5 +1,5 @@ name:                hackernews-version:             0.3.1.0+version:             0.3.1.1 description:         API for news.ycombinator.com license:             MIT synopsis:            API for Hacker News@@ -11,7 +11,7 @@ cabal-version:       >=1.10  library-  ghc-options:         -Wall -threaded -rtsopts+  ghc-options:         -Wall -rtsopts   exposed-modules:     Web.HackerNews   other-modules:       Web.HackerNews.Types                      , Web.HackerNews.Client
src/Web/HackerNews/Client.hs view
@@ -1,10 +1,13 @@ {-# LANGUAGE OverloadedStrings #-}+------------------------------------------------------------------------------ -- | -- Module      : Web.HackerNews.Client -- Copyright   : (c) David Johnson, 2014 -- Maintainer  : djohnson.m@gmail.com -- Stability   : experimental -- Portability : POSIX+-- | +------------------------------------------------------------------------------ module Web.HackerNews.Client        ( hackerNews        , buildHNRequest@@ -12,13 +15,14 @@        , HackerNewsError (..)        ) where +------------------------------------------------------------------------------ import           Data.Aeson                 hiding (Result) import           Data.Aeson.Parser          (value) import           Data.Attoparsec.ByteString (parseOnly) import           Data.Either                (rights) import           Control.Monad.Trans.Either   import           Control.Exception          (try, SomeException)-+import          Control.Monad               (when) import           Control.Monad.IO.Class     (liftIO) import           Control.Monad.Trans.Class  (lift) import           Control.Monad.Trans.Reader (ReaderT, ask, runReaderT)@@ -28,8 +32,14 @@ import           Network.Http.Client import           OpenSSL                    (withOpenSSL) import qualified System.IO.Streams          as Streams+------------------------------------------------------------------------------  ------------------------------------------------------------------------------+-- | Debug flag+debug :: Bool+debug = False++------------------------------------------------------------------------------ -- | Core Type type HackerNews a = EitherT HackerNewsError (ReaderT Connection IO) a @@ -71,7 +81,7 @@     case bytes of       Nothing -> left RequestError       Just bs -> do-        liftIO $ print bs+        when debug $ liftIO . print $ bs         let xs = rights [parseOnly value bs, parseOnly json bs]         case xs of           []    -> left ParseError