rest-client 0.2.3.5 → 0.3.0.0
raw patch · 3 files changed
+19/−13 lines, 3 filesdep +exceptionsdep +primitivedep ~basedep ~http-conduitdep ~resourcetPVP ok
version bump matches the API change (PVP)
Dependencies added: exceptions, primitive
Dependency ranges changed: base, http-conduit, resourcet
API changes (from Hackage documentation)
- Rest.Client.Base: instance (MonadBaseControl IO m, Monad m, Functor m, MonadUnsafeIO m, MonadIO m, MonadThrow m) => ApiStateC (ApiT m)
- Rest.Client.Base: instance (MonadIO m, MonadThrow m, MonadUnsafeIO m, Functor m, Applicative m) => MonadResource (ApiT m)
+ Rest.Client.Base: instance (MonadBaseControl IO m, Monad m, Functor m, MonadBase IO m, PrimMonad IO, MonadIO m, MonadThrow m) => ApiStateC (ApiT m)
+ Rest.Client.Base: instance (MonadIO m, MonadThrow m, MonadBase IO m, PrimMonad IO, Functor m, Applicative m) => MonadResource (ApiT m)
- Rest.Client.Base: class (MonadResource m, MonadBaseControl IO m, Monad m, Functor m, MonadUnsafeIO m) => ApiStateC m
+ Rest.Client.Base: class (MonadResource m, MonadBaseControl IO m, Monad m, Functor m, MonadBase IO m, PrimMonad IO) => ApiStateC m
- Rest.Client.Base: runT :: (MonadBaseControl IO m, Monad m) => ApiInfo -> ApiState -> ApiT m a -> m a
+ Rest.Client.Base: runT :: (MonadBaseControl IO m, Monad m) => ApiInfo -> ApiState -> ApiT m a -> ResourceT m a
Files
- CHANGELOG.md +6/−0
- rest-client.cabal +5/−3
- src/Rest/Client/Base.hs +8/−10
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## 0.3.0.0++* Replace runT' -> runT, use runResourceT (runT ...) if you want the old behavior++* Allow `http-conduit == 2.1.*+ #### 0.2.3.5 * Allow `mtl == 2.2.*`
rest-client.cabal view
@@ -1,5 +1,5 @@ name: rest-client-version: 0.2.3.5+version: 0.3.0.0 description: Utility library for use in generated API client libraries. synopsis: Utility library for use in generated API client libraries. maintainer: code@silk.co@@ -31,13 +31,15 @@ , case-insensitive >= 0.4 && < 1.3 , data-default == 0.5.* , exception-transformers == 0.3.*- , http-conduit >= 1.9.2.1 && < 2.2+ , http-conduit == 2.1.* , http-types >= 0.7 && < 0.9 , hxt >= 9.2 && < 9.4 , hxt-pickle-utils == 0.1.* , monad-control == 0.3.* , mtl >= 2.0 && < 2.3- , resourcet >= 0.4 && < 0.5+ , resourcet == 1.1.*+ , primitive == 0.5.*+ , exceptions >= 0.5 && < 0.7 , rest-types == 1.10.* , tostring == 0.2.* , transformers-base == 0.4.*
src/Rest/Client/Base.hs view
@@ -32,6 +32,7 @@ import Control.Monad.Error hiding (mapM) import Control.Monad.Exception import Control.Monad.List hiding (mapM)+import Control.Monad.Primitive (PrimMonad) import Control.Monad.RWS hiding (mapM) import Control.Monad.Reader hiding (mapM) import Control.Monad.State hiding (mapM)@@ -62,12 +63,12 @@ type Api = ApiT IO -class (MonadResource m, MonadBaseControl IO m, Monad m, Functor m, MonadUnsafeIO m) => ApiStateC m where+class (MonadResource m, MonadBaseControl IO m, Monad m, Functor m, MonadBase IO m, PrimMonad IO) => ApiStateC m where getApiState :: m ApiState putApiState :: ApiState -> m () askApiInfo :: m ApiInfo -instance (MonadBaseControl IO m, Monad m, Functor m, MonadUnsafeIO m, MonadIO m, MonadThrow m) => ApiStateC (ApiT m) where+instance (MonadBaseControl IO m, Monad m, Functor m, MonadBase IO m, PrimMonad IO, MonadIO m, MonadThrow m) => ApiStateC (ApiT m) where getApiState = ApiT get putApiState = ApiT . put askApiInfo = ApiT (lift ask)@@ -96,9 +97,9 @@ throw = lift . throw catch c f = ApiT (unApiT c `catch` (unApiT . f)) -instance MonadThrow m => MonadThrow (ApiT m) where monadThrow = ApiT . lift . lift . lift . monadThrow+instance MonadThrow m => MonadThrow (ApiT m) where throwM = ApiT . lift . lift . lift . throwM -instance (MonadIO m, MonadThrow m, MonadUnsafeIO m, Functor m, Applicative m) => MonadResource (ApiT m) where+instance (MonadIO m, MonadThrow m, MonadBase IO m, PrimMonad IO, Functor m, Applicative m) => MonadResource (ApiT m) where liftResourceT = ApiT . lift . lift . transResourceT liftIO instance (Error e, ApiStateC m) => ApiStateC (ErrorT e m) where@@ -131,11 +132,8 @@ askApiInfo = lift askApiInfo putApiState = lift . putApiState -runT :: (MonadBaseControl IO m, Monad m) => ApiInfo -> ApiState -> ApiT m a -> m a-runT inf st api = runResourceT $ runT' inf st api--runT' :: (MonadBaseControl IO m, Monad m) => ApiInfo -> ApiState -> ApiT m a -> ResourceT m a-runT' inf st api = runReaderT (evalStateT (unApiT api) st) inf+runT :: (MonadBaseControl IO m, Monad m) => ApiInfo -> ApiState -> ApiT m a -> ResourceT m a+runT inf st api = runReaderT (evalStateT (unApiT api) st) inf run :: String -> ApiT IO a -> IO a run = flip runWithPort 80@@ -143,7 +141,7 @@ runWithPort :: String -> Int -> ApiT IO a -> IO a runWithPort hst prt api = withManager $ \m ->- runT' (ApiInfo m hst prt []) (ApiState (createCookieJar [])) api+ runT (ApiInfo m hst prt []) (ApiState (createCookieJar [])) api data ApiResponse e a = ApiResponse