Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to stackage version 10.5 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 17 additions & 1 deletion 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
#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