packages feed

magicbane 0.1.3 → 0.1.4

raw patch · 4 files changed

+51/−51 lines, 4 filesdep −eitherdep ~servant-server

Dependencies removed: either

Dependency ranges changed: servant-server

Files

library/Magicbane.hs view
@@ -15,7 +15,6 @@ import           Control.Concurrent.Async.Lifted as X -- Classy reexports …Lifted.Safe which doesn't work with ExceptT import           Control.Error.Util as X hiding (hoistEither, (??), tryIO, bool) import           Control.Monad.Trans.Control as X-import           Control.Monad.Trans.Either as X import           Control.Monad.Trans.Maybe as X hiding (liftListen, liftPass, liftCallCC) import qualified System.Envy import           System.Envy as X hiding ((.=), (.!=), decode)
library/Magicbane/App.hs view
@@ -11,7 +11,7 @@  import           ClassyPrelude hiding (Handler) import           Control.Monad.Trans.Except as X-import           Control.Monad.Except as X (MonadError, throwError)+import           Control.Monad.Error.Class as X (MonadError, throwError) import           Data.Proxy as X import           Data.Has as X import           Servant as X hiding (And)
library/Magicbane/HTTPClient.hs view
@@ -10,7 +10,7 @@ ) where  import           ClassyPrelude-import           Control.Monad.Trans.Either+import           Control.Monad.Trans.Except import           Data.Has import           Data.Conduit import qualified Data.Conduit.Combinators as C@@ -34,40 +34,40 @@  type MonadHTTP ψ μ = (HasHttpManager ψ, MonadReader ψ μ, MonadIO μ, MonadBaseControl IO μ) -runHTTP ∷ EitherT ε μ α → μ (Either ε α)-runHTTP = runEitherT+runHTTP ∷ ExceptT ε μ α → μ (Either ε α)+runHTTP = runExceptT  -- | Creates a request from a URI.-reqU ∷ (MonadHTTP ψ μ) ⇒ URI → EitherT Text μ Request-reqU uri = hoistEither $ bimap tshow id $ setUri defaultRequest uri+reqU ∷ (MonadHTTP ψ μ) ⇒ URI → ExceptT Text μ Request+reqU uri = ExceptT $ return $ bimap tshow id $ setUri defaultRequest uri  -- | Creates a request from a string of any type, parsing it into a URI.-reqS ∷ (MonadHTTP ψ μ, ConvertibleStrings σ String) ⇒ σ → EitherT Text μ Request-reqS uri = hoistEither $ bimap tshow id $ parseUrlThrow $ cs uri+reqS ∷ (MonadHTTP ψ μ, ConvertibleStrings σ String) ⇒ σ → ExceptT Text μ Request+reqS uri = ExceptT $ return $ bimap tshow id $ parseUrlThrow $ cs uri  -- | Configures the request to not throw errors on error status codes.-anyStatus ∷ (MonadHTTP ψ μ) ⇒ Request → EitherT Text μ Request+anyStatus ∷ (MonadHTTP ψ μ) ⇒ Request → ExceptT Text μ Request anyStatus req = return $ setRequestIgnoreStatus req  -- | Sets a x-www-form-urlencoded form as the request body (also sets the content-type).-postForm ∷ (MonadHTTP ψ μ) ⇒ [(Text, Text)] → Request → EitherT Text μ Request+postForm ∷ (MonadHTTP ψ μ) ⇒ [(Text, Text)] → Request → ExceptT Text μ Request postForm form req =   return req { method = "POST"              , requestHeaders = [ (hContentType, "application/x-www-form-urlencoded; charset=utf-8") ]              , requestBody = RequestBodyBS $ writeForm form }  -- | Performs the request, using a given function to read the body. This is what all other performWith functions are based on.-performWithFn ∷ (MonadHTTP ψ μ, MonadCatch μ) ⇒ (ConduitM ι ByteString μ () → μ ρ) → Request → EitherT Text μ (Response ρ)+performWithFn ∷ (MonadHTTP ψ μ, MonadCatch μ) ⇒ (ConduitM ι ByteString μ () → μ ρ) → Request → ExceptT Text μ (Response ρ) performWithFn fn req = do   res ← lift $ tryAny $ HCC.withResponse req $ \res → do     body ← fn $ responseBody res     return res { responseBody = body }-  hoistEither $ bimap tshow id res+  ExceptT $ return $ bimap tshow id res  -- | Performs the request, ignoring the body.-performWithVoid ∷ (MonadHTTP ψ μ, MonadCatch μ) ⇒ Request → EitherT Text μ (Response ())+performWithVoid ∷ (MonadHTTP ψ μ, MonadCatch μ) ⇒ Request → ExceptT Text μ (Response ()) performWithVoid = performWithFn (const $ return ())  -- | Performs the request, reading the body into a lazy ByteString.-performWithBytes ∷ (MonadHTTP ψ μ, MonadCatch μ) ⇒ Request → EitherT Text μ (Response LByteString)+performWithBytes ∷ (MonadHTTP ψ μ, MonadCatch μ) ⇒ Request → ExceptT Text μ (Response LByteString) performWithBytes = performWithFn ($$ C.sinkLazy)
magicbane.cabal view
@@ -1,9 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.18.1.+-- This file has been generated from package.yaml by hpack version 0.20.0. -- -- see: https://github.com/sol/hpack+--+-- hash: d745301cacd1d82cdb20fad978024069617cdb814742a11f1fda1ea280068d7b  name:           magicbane-version:        0.1.3+version:        0.1.4 synopsis:       A web framework that integrates Servant, ClassyPrelude, EKG, fast-logger, wai-cli…  description:    Inspired by Dropwizard, Magicbane provides a packaged framework for developing web services using the best available libraries, including Servant, ClassyPrelude, Aeson, EKG/monad-metrics, fast-logger/monad-logger, wai-cli and others.@@ -27,49 +29,48 @@       library   ghc-options: -Wall   build-depends:-      base >=4.8.0.0 && <5+      aeson+    , aeson-qq+    , attoparsec+    , base >=4.8.0.0 && <5     , classy-prelude-    , transformers+    , conduit+    , conduit-combinators+    , data-default+    , data-has+    , ekg-core+    , ekg-wai+    , envy     , errors-    , split-    , either-    , mtl-    , refined+    , fast-logger+    , http-api-data+    , http-client+    , http-client-tls+    , http-conduit+    , http-date+    , http-link-header+    , http-media+    , http-types     , lifted-async+    , mime-types     , monad-control-    , monad-metrics     , monad-logger-    , fast-logger-    , ekg-core-    , ekg-wai-    , data-default-    , data-has+    , monad-metrics+    , mtl+    , network+    , network-uri+    , raw-strings-qq+    , refined+    , servant+    , servant-server+    , split     , string-conversions-    , unordered-containers-    , attoparsec     , text-    , conduit-    , conduit-combinators-    , aeson-    , aeson-qq-    , raw-strings-qq+    , transformers+    , unordered-containers     , wai-    , wai-middleware-metrics     , wai-cli-    , servant-    , servant-server-    , network-uri-    , network-    , http-types-    , http-media-    , http-client-    , http-client-tls-    , http-conduit-    , http-link-header-    , http-date-    , http-api-data-    , mime-types-    , envy+    , wai-middleware-metrics   exposed-modules:       Magicbane       Magicbane.App