yam 0.5.10 → 0.5.11
raw patch · 3 files changed
+18/−49 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- src/Yam/Middleware.hs +10/−3
- src/Yam/Types/Prelude.hs +3/−37
- yam.cabal +5/−9
src/Yam/Middleware.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ImplicitParams #-} module Yam.Middleware( AppMiddleware(..)@@ -12,11 +13,17 @@ -- | Application Middleware newtype AppMiddleware = AppMiddleware {runAM :: Env -> ((Env, Middleware)-> LoggingT IO ()) -> LoggingT IO ()} -instance Semigroup AppMiddleware where- (AppMiddleware am) <> (AppMiddleware bm) = AppMiddleware $ \e f -> am e $ \(e', mw) -> bm e' $ \(e'',mw') -> f (e'', mw . mw')- instance Monoid AppMiddleware where mempty = AppMiddleware $ \a f -> f (a,id)+#if __GLASGOW_HASKELL__ >= 804+instance Semigroup AppMiddleware where+ (<>) = _append+#else+ mappend = _append+#endif+++_append (AppMiddleware am) (AppMiddleware bm) = AppMiddleware $ \e f -> am e $ \(e', mw) -> bm e' $ \(e'',mw') -> f (e'', mw . mw') -- | Simple AppMiddleware simpleAppMiddleware :: HasCallStack => (Bool, Text) -> Key a -> a -> AppMiddleware
src/Yam/Types/Prelude.hs view
@@ -10,12 +10,6 @@ , randomCode , whenException -- * Reexport Functions-#if !MIN_VERSION_salak(0,1,7)- , (.>>)- , (.?>)- , (.?=)- , (.|=)-#endif , LogFunc , Default(..) , Text@@ -29,6 +23,7 @@ , throw , try , catch+ , (<>) , module Data.Proxy , module Data.Vault.Lazy , module Data.Maybe@@ -59,6 +54,7 @@ import Data.Default import Data.Function import Data.Maybe+import Data.Monoid ((<>)) import Data.Proxy import Data.Salak ( FromProperties (..)@@ -67,6 +63,7 @@ , Return , defaultPropertiesWithFile )+import Data.Salak ((.>>), (.?=), (.?>), (.|=)) import Data.Text (Text, pack) import Data.Text.Encoding (decodeUtf8, encodeUtf8) import Data.Vault.Lazy (Key, Vault, newKey)@@ -80,37 +77,6 @@ import Servant.Server.Internal.ServantErr import System.IO.Unsafe (unsafePerformIO) import System.Random.MWC--#if MIN_VERSION_salak(0,1,7)-import Data.Salak ((.>>), (.?=), (.?>), (.|=))-#else-import qualified Data.Salak as S-import Data.Text (unpack)--infixl 5 .?>-(.?>) :: FromProperties a => Properties -> Text -> Return a-(.?>) = flip S.lookup'--infixl 5 .|=-(.|=) :: Return a -> a -> a-(.|=) (S.OK a) _ = a-(.|=) (S.Fail e) _ = error e-(.|=) _ d = d--infixl 5 .?=-(.?=) :: Return a -> a -> Return a-(.?=) a b = S.OK (a .|= b)--infixl 5 .>>-(.>>) :: FromProperties a => Properties -> Text -> a-(.>>) p k = case p .?> k of- S.OK v -> v- S.Empty -> case fromProperties S.empty of- (S.OK a) -> a- (S.Fail e) -> error e- _ -> error $ "Config " <> unpack k <> " not found"- S.Fail e -> error e-#endif type LogFunc = Loc -> LogSource -> LogLevel -> LogStr -> IO ()
yam.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: yam-version: 0.5.10+version: 0.5.11 license: BSD3 license-file: LICENSE copyright: (c) 2018 Daniel YU@@ -47,11 +47,9 @@ RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeApplications TypeFamilies TypeOperators TypeSynonymInstances ViewPatterns- ghc-options: -Wall -Wcompat -Wincomplete-record-updates- -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-orphans- -fno-warn-missing-signatures+ ghc-options: -Wall -fno-warn-orphans -fno-warn-missing-signatures build-depends:- base >=4.11 && <5,+ base >=4.9 && <5, base16-bytestring >=0.1.1.6 && <0.2, binary >=0.8.6.0 && <0.9, bytestring >=0.10.8.2 && <0.11,@@ -114,12 +112,10 @@ RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeApplications TypeFamilies TypeOperators TypeSynonymInstances ViewPatterns- ghc-options: -Wall -Wcompat -Wincomplete-record-updates- -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-orphans- -fno-warn-missing-signatures+ ghc-options: -Wall -fno-warn-orphans -fno-warn-missing-signatures build-depends: QuickCheck >=2.12.6.1 && <2.13,- base >=4.11 && <5,+ base >=4.9 && <5, base16-bytestring >=0.1.1.6 && <0.2, binary >=0.8.6.0 && <0.9, bytestring >=0.10.8.2 && <0.11,