magicbane 0.4.0 → 0.5.0
raw patch · 4 files changed
+14/−13 lines, 4 filesdep ~servant-server
Dependency ranges changed: servant-server
Files
- library/Magicbane.hs +1/−1
- library/Magicbane/App.hs +2/−2
- library/Magicbane/Util.hs +4/−4
- magicbane.cabal +7/−6
library/Magicbane.hs view
@@ -29,7 +29,7 @@ import Network.HTTP.Link as X hiding (Link) import Network.HTTP.Types as X hiding (Header) import Network.Wai as X (Application, Middleware)-import Network.Wai.Cli as X hiding (port)+import Network.Wai.Cli as X import Magicbane.App as X hiding (Or) import Magicbane.Config as X import Magicbane.Has as X
library/Magicbane/App.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax, TypeApplications, ScopedTypeVariables, CPP #-}+{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax, TypeApplications, ScopedTypeVariables, CPP, TypeOperators, FlexibleContexts #-} -- | Extends Servant with context, based on RIO. -- The context should be a tuple of all your moudles and configs and stuff, so that the Data.Has module would let you access these items by type.@@ -18,6 +18,6 @@ runMagicbaneHandler ctx a = Servant.Handler $ ExceptT $ try $ runReaderT (unRIO a) ctx -- | Constructs a WAI application from an API definition, a Servant context (used for auth mainly), the app context and the actual action handlers.-magicbaneApp ∷ forall β χ ψ. (HasServer χ ψ) ⇒ Proxy χ → Context ψ → β → ServerT χ (RIO β) → Application+magicbaneApp ∷ forall β χ ψ. (HasServer χ ψ, HasContextEntry (ψ .++ DefaultErrorFormatters) ErrorFormatters) ⇒ Proxy χ → Context ψ → β → ServerT χ (RIO β) → Application magicbaneApp api sctx ctx actions = serveWithContext api sctx $ srv ctx where srv c = hoistServerWithContext api (Proxy @ψ) (runMagicbaneHandler c) actions
library/Magicbane/Util.hs view
@@ -94,11 +94,11 @@ T.filter (`onotElem` ("!^*?()[]{}`./\\'\"~|"::String)) . T.toLower . T.strip --- | Creates a simple text/plain ServantErr.-errText ∷ ServantErr → L.ByteString → ServantErr+-- | Creates a simple text/plain ServerError+errText ∷ ServerError → L.ByteString → ServerError errText e t = e { errHeaders = [ (hContentType, "text/plain; charset=utf-8") ] , errBody = t } --- | Creates and throws a simple text/plain ServantErr.-throwErrText ∷ MonadThrow μ ⇒ ServantErr → L.ByteString → μ α+-- | Creates and throws a simple text/plain ServerError.+throwErrText ∷ MonadThrow μ ⇒ ServerError → L.ByteString → μ α throwErrText e t = throwM $ errText e t
magicbane.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.28.2.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.34.2. -- -- see: https://github.com/sol/hpack ----- hash: fc096cdac0f766409152087a8e14aa8f6fb03ec3925e6b49f1c29e3feaa5e600+-- hash: 9ccf29b1676abbc411ffa8622c3786b3bf156e6c1d2e17720bbc4717a5179941 name: magicbane-version: 0.4.0+version: 0.5.0 synopsis: A web framework that integrates Servant, RIO, 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, RIO, Aeson, EKG/monad-metrics, fast-logger, wai-cli and others.@@ -16,9 +18,8 @@ maintainer: greg@unrelenting.technology copyright: 2017-2018 Greg V <greg@unrelenting.technology> license: PublicDomain-tested-with: GHC==8.4.2+tested-with: GHC==8.6.5 build-type: Simple-cabal-version: >= 1.10 source-repository head type: git@@ -60,7 +61,7 @@ , refined , rio , rio-orphans- , servant-server >=0.12+ , servant-server >=0.18 , split , string-conversions , text