Skip to content

Commit

Permalink
Updates to stackage version 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
abhin4v committed Feb 19, 2018
1 parent bc185b2 commit ffc333f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ig.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ library
base >= 4 && < 5
, bytestring >= 0.9 && < 0.11
, text >= 0.11
, transformers >= 0.2 && < 0.5
, transformers >= 0.2 && < 0.6
, transformers-base
, monad-control
, resourcet
, http-types
, http-conduit >= 2.0 && < 2.2
, http-conduit >= 2.0 && < 2.3
, aeson >= 0.5
, time
, data-default
Expand All @@ -62,7 +62,7 @@ library
if flag(conduit11)
build-depends:
conduit >= 1.1.0.0 && < 1.3
, conduit-extra == 1.1.*
, conduit-extra >= 1.1.0.0 && < 1.3
else
build-depends:
conduit == 1.0.*
Expand Down
20 changes: 18 additions & 2 deletions src/Instagram/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Instagram.Monad (
import Instagram.Types

import Control.Applicative
import Control.Monad (MonadPlus, liftM)
import Control.Monad (MonadPlus, liftM, void)
import Control.Monad.Base (MonadBase(..))
import Control.Monad.Fix (MonadFix)
import Control.Monad.IO.Class (MonadIO)
Expand Down Expand Up @@ -132,7 +132,11 @@ getPostRequest :: (Monad m,HT.QueryLike q) => ByteString -- ^ the url path
-> InstagramT m H.Request -- ^ the properly configured request
getPostRequest path query=do
host<-getHost
#if MIN_VERSION_http_conduit(2,2,0)
return $ H.defaultRequest {
#else
return $ def {
#endif
H.secure=True
, H.host = host
, H.port = 443
Expand All @@ -151,7 +155,11 @@ getGetRequest path query=do
#if DEBUG
liftIO $ BSC.putStrLn $ BS.append path qs
#endif
#if MIN_VERSION_http_conduit(2,2,0)
return $ H.defaultRequest {
#else
return $ def {
#endif
H.secure=True
, H.host = host
, H.port = 443
Expand Down Expand Up @@ -184,14 +192,22 @@ igReq :: forall b (m :: * -> *) wrappedErr .
-> InstagramT m b
igReq req extractError=do
-- we check the status ourselves
#if MIN_VERSION_http_conduit(2,2,0)
let req' = req { H.checkResponse = \_ _ -> return () }
#else
let req' = req { H.checkStatus = \_ _ _ -> Nothing }
#endif
mgr<-getManager
res<-H.http req' mgr
let status = H.responseStatus res
headers = H.responseHeaders res
cookies = H.responseCookieJar res
ok=isOkay status
err=H.StatusCodeException status headers cookies
#if MIN_VERSION_http_conduit(2,2,0)
err=H.HttpExceptionRequest req $ H.StatusCodeException (void res) (HT.statusMessage status)
#else
err=H.StatusCodeException status headers cookies
#endif
L.catch (do
#if DEBUG
#if CONDUIT11
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ flags:
packages:
- '.'
extra-deps: []
resolver: lts-5.8
resolver: lts-10.5

0 comments on commit ffc333f

Please sign in to comment.