rio 0.1.4.0 → 0.1.5.0
raw patch · 8 files changed
+66/−9 lines, 8 files
Files
- ChangeLog.md +9/−0
- README.md +1/−1
- rio.cabal +6/−4
- src/RIO/Partial.hs +10/−0
- src/RIO/Prelude/Logger.hs +10/−0
- src/RIO/Prelude/Reexports.hs +19/−0
- src/RIO/Process.hs +4/−4
- test/RIO/LoggerSpec.hs +7/−0
ChangeLog.md view
@@ -1,5 +1,14 @@ # Changelog for rio +## 0.1.5.0++* Re-export `Numeric.Natural.Natural` [#119](https://github.com/commercialhaskell/rio/issues/119)+* Re-export `Data.Functor.<&>` from GHC 8.4+, falling back local definition for `base < 4.11` [#117](https://github.com/commercialhaskell/rio/issues/117)+* Re-export `Data.Proxy.Proxy(..)`+* Re-export `fromEnum` from RIO, export `toEnum`, `read` and `fromJust` from RIO.Partial+* Add `noLogging` function to skip logging on specific sub-routines+* Re-export `Control.Category.>>>`+ ## 0.1.4.0 * Add `Const` and `Identity`
README.md view
@@ -283,7 +283,7 @@ configL = id data Env = Env { envLogFunc :: !LogFunc, envConfig :: !Config }- class (HasLogFunc env, HasConfig env) => HasEnv Env where+ class (HasLogFunc env, HasConfig env) => HasEnv env where envL :: Lens' env Env instance HasLogFunc Env where logFuncL = lens envLogFunc (\x y -> x { envLogFunc = y })
rio.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.28.2.+cabal-version: >= 1.10++-- This file has been generated from package.yaml by hpack version 0.29.0. -- -- see: https://github.com/sol/hpack ----- hash: 11d51864811c17133c8f1aecfbec3086de7f37c755fad2fb3e2c54ed8b85f817+-- hash: 065129e1a5740200c161b7c7db66dfdea6edee782d518b17f86ccd1a8defb48c name: rio-version: 0.1.4.0+version: 0.1.5.0 synopsis: A standard library for Haskell description: See README and Haddocks at <https://www.stackage.org/package/rio> category: Control@@ -16,7 +18,6 @@ license: MIT license-file: LICENSE build-type: Simple-cabal-version: >= 1.10 extra-source-files: ChangeLog.md README.md@@ -44,6 +45,7 @@ RIO.Map RIO.Map.Partial RIO.Map.Unchecked+ RIO.Partial RIO.Prelude.Simple RIO.Process RIO.Seq
+ src/RIO/Partial.hs view
@@ -0,0 +1,10 @@+-- | Partial functions.+--+module RIO.Partial+ ( Data.Maybe.fromJust+ , Prelude.read+ , Prelude.toEnum+ ) where++import qualified Data.Maybe+import qualified Prelude
src/RIO/Prelude/Logger.hs view
@@ -44,6 +44,7 @@ , CallStack -- * Convenience functions , displayCallStack+ , noLogging -- * Accessors , logFuncUseColorL ) where@@ -604,3 +605,12 @@ -- @since 0.1.0.0 logFuncUseColorL :: HasLogFunc env => SimpleGetter env Bool logFuncUseColorL = logFuncL.to (maybe False logUseColor . lfOptions)++-- | Disable logging capabilities in a given sub-routine+--+-- Intended to skip logging in general purpose implementations, where secrets+-- might be logged accidently.+--+-- @since 0.1.5.0+noLogging :: (HasLogFunc env, MonadReader env m) => m a -> m a+noLogging = local (set logFuncL mempty)
src/RIO/Prelude/Reexports.hs view
@@ -24,6 +24,7 @@ , Control.Arrow.second , (Control.Arrow.&&&) , (Control.Arrow.***)+ , (Control.Category.>>>) , Control.DeepSeq.NFData(..) , Control.DeepSeq.force , (Control.DeepSeq.$!!)@@ -114,6 +115,11 @@ , Data.Functor.void , (Data.Functor.$>) , (Data.Functor.<$>)+#if MIN_VERSION_base(4, 11, 0)+ , (Data.Functor.<&>)+#else+ , (<&>)+#endif , Data.Functor.Const.Const(..) , Data.Functor.Identity.Identity(..) , Data.Hashable.Hashable@@ -157,6 +163,7 @@ , Data.Ord.Ord(..) , Data.Ord.Ordering(..) , Data.Ord.comparing+ , Data.Proxy.Proxy(..) , Data.Semigroup.Semigroup (..) , Data.Set.Set , Data.String.IsString(..)@@ -184,6 +191,7 @@ , Foreign.Storable.Storable , GHC.Generics.Generic , GHC.Stack.HasCallStack+ , Numeric.Natural.Natural , Prelude.Bounded (..) , Prelude.Double , Prelude.Enum@@ -205,6 +213,7 @@ , Prelude.curry , Prelude.error , Prelude.even+ , Prelude.fromEnum , Prelude.fromIntegral , Prelude.fst , Prelude.gcd@@ -266,6 +275,7 @@ -- Reexports import qualified Control.Applicative import qualified Control.Arrow+import qualified Control.Category import qualified Control.DeepSeq import qualified Control.Monad import qualified Control.Monad.Catch@@ -291,6 +301,7 @@ import qualified Data.Map.Strict import qualified Data.Maybe import qualified Data.Ord+import qualified Data.Proxy import qualified Data.Set import qualified Data.Text.Encoding.Error import qualified Data.Traversable@@ -300,6 +311,7 @@ import qualified Foreign.Storable import qualified GHC.Generics import qualified GHC.Stack+import qualified Numeric.Natural import qualified Prelude import qualified System.Exit import qualified Text.Read@@ -307,3 +319,10 @@ yieldThread :: MonadIO m => m () yieldThread = UnliftIO.Concurrent.yield {-# INLINE yieldThread #-}++#if !MIN_VERSION_base(4, 11, 0)+(<&>) :: Functor f => f a -> (a -> b) -> f b+as <&> f = f Data.Functor.<$> as++infixl 1 <&>+#endif
src/RIO/Process.hs view
@@ -25,10 +25,10 @@ -- value (this time 'ProcessContext'), and include it in your 'RIO' -- environment. See 'mkProcessContext'. ----- * Instead of using the 'proc' function for creating a--- 'ProcessConfig', use the 'proc' function, which will handle--- overriding environment variables, looking up paths, performing--- logging, etc.+-- * Instead of using the 'System.Process.Typed.proc' function from+-- "System.Process.Typed" for creating a 'ProcessConfig', use the+-- locally defined 'proc' function, which will handle overriding+-- environment variables, looking up paths, performing logging, etc. -- -- Once you have your 'ProcessConfig', use the standard functions from -- 'System.Process.Typed' (reexported here for convenient) for running
test/RIO/LoggerSpec.hs view
@@ -46,3 +46,10 @@ logInfo "no verbose log" builder <- readIORef ref toLazyByteString builder `shouldBe` "[info] verbose log\nno verbose log\n"+ it "noLogging" $ do+ (ref, options) <- logOptionsMemory+ withLogFunc (options & setLogVerboseFormat True) $ \lf -> runRIO lf $ do+ logInfo "should appear"+ noLogging $ logInfo "should not appear"+ builder <- readIORef ref+ toLazyByteString builder `shouldBe` "[info] should appear\n"