packages feed

di 1.0 → 1.0.1

raw patch · 3 files changed

+37/−21 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Di: class Monad m => MonadDi level path msg (m :: * -> *) | m -> level path msg
- Di: data Di level path msg
- Di: data DiT level path msg (m :: * -> *) a
+ Di: data Level :: *
+ Di: data Path :: *
+ Di: type Df1 = Di Level Path Message
+ Di: type Df1T = DiT Level Path Message
+ Di: type MonadDf1 = MonadDi Level Path Message
- Di: data Key
+ Di: data Key :: *
- Di: data Message
+ Di: data Message :: *
- Di: data Segment
+ Di: data Segment :: *
- Di: data Value
+ Di: data Value :: *
- Di: hoistDiT :: () => forall x. () => n x -> m x -> forall x. () => m x -> n x -> DiT level path msg m a -> DiT level path msg n a
+ Di: hoistDiT :: () => (forall x. () => n x -> m x) -> (forall x. () => m x -> n x) -> DiT level path msg m a -> DiT level path msg n a

Files

CHANGELOG.md view
@@ -1,3 +1,13 @@+# Version 1.0.1++* COMPILER ASSISTED BREAKING CHANGE: We don't export `Di`, `DiT` nor `MonadDi`+  anymore.++* Re-export `Df1.Path`, `Df1.Level`, `Di.Df1.Df1`, `Di.Df1.Monad.Df1T`,+  `Di.Df1.Monad.MonadDf1`.+++ # Version 1.0  * BREAKING CHANGE: Most of what used to be in this library lives now in
di.cabal view
@@ -1,5 +1,5 @@ name: di-version: 1.0+version: 1.0.1 author: Renzo Carbonara maintainer: renλren.zone copyright: Renzo Carbonara 2017-2018
lib/Di.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}--- | This module is a highly opinionated, basic, and yet surprisingly sufficient+-- | This module is a highly opinionated, basic, and yet sufficient -- choice of a concrete stack of logging solutions belonging to the [di -- logging ecosystem](https://github.com/k0001/di)—an otherwise rather -- general ecosystem, flexible and full of choices.@@ -43,13 +43,16 @@ -- 'Df1.Level', 'Df1.Path' and 'Df1.Message', and some other functions -- talk about @level@, @path@ and @msg@ type variables. This is -- because even while our particular set of choices require some monomorphic--- types, the /di logging ecosystem/ treats these values polymorphically, so--- they will show up in the types in one way or another, either in concrete or--- polymorphic form. This can seem a bit noisy, but the good news is that if,--- for example, want to call a third party library that uses other types--- for conveying the idea of a “log importance level” or a “log message”,--- then you can do so if you can convert between these different types.--- For more information about this, see "Di.Monad" and "Di.Core", but not today.+-- types, as demonstrated by the 'Di.Df1.Df1' and 'Di.Df1.Monad.MonadDf1'+-- type-synonyms, the larger /di logging ecosystem/ treats these values+-- polymorphically, so they will show up in the types in one way or another,+-- either in concrete or polymorphic form. This can seem a bit noisy, but the+-- good news is that if, for example, want to call a third party library that+-- uses other types for conveying the idea of a “log importance level” or a “log+-- message”, then you can do so if you can convert between these different+-- types. You are of course encouraged to use the 'Di.Df1.Df1' and+-- 'Di.Df1.Monad.MonadDf1' type-synonyms yourself.  For more information about+-- this, see "Di.Monad" and "Di.Core", but not today. -- -- The intended usage of this module is: --@@ -58,13 +61,14 @@ -- @ module Di  ( new- , Di.Core.Di+ , Di.Df1.Df1     -- * Monadic API- , Di.Monad.MonadDi+ , Di.Df1.Monad.MonadDf1     -- ** Hierarchy  , Di.Df1.Monad.push+ , Df1.Path  , Df1.Segment  , Df1.segment @@ -76,6 +80,7 @@  , Df1.value     -- ** Messages+ , Df1.Level  , Df1.Message  , Di.Df1.Monad.debug  , Di.Df1.Monad.info@@ -87,7 +92,7 @@  , Di.Df1.Monad.emergency     -- * Basic DiT support- , Di.Monad.DiT+ , Di.Df1.Monad.Df1T  , Di.Monad.runDiT  , Di.Monad.hoistDiT  ) where@@ -114,9 +119,9 @@ -- main :: 'IO' () -- main = do --    'new' $ \\di -> do+--       -- /The rest of your program goes here./+--       -- /You can start logging right away./ --       'Di.Monad.runDiT' di $ do---           -- /The rest of your program goes here./---           -- /You can start logging right away./ --           'Di.Df1.Monad.notice' "Welcome to my program!" --           -- /You can use 'Di.Df1.Monad.push' to separate different/ --           -- /logging scopes of your program:/@@ -149,17 +154,18 @@ new   :: (MonadIO m, Ex.MonadMask m)   => (Di.Core.Di Df1.Level Df1.Path Df1.Message -> m a)+  -- ^ /This type is the same as @'Di.Df1.Df1' -> m a@./+  --   -- ^ Within this scope, you can use the obtained 'Di.Core.Di' safely, even   -- concurrently. As soon as @m a@ finishes, 'new' will block until   -- all logs have finished processing, before returning.   ---  -- /WARNING:/ Even while-  -- @'new' commit 'pure' :: m ('Di.Core.Di' 'Df1.Level' 'Df1.Path' 'Df1.Message')@-  -- type-checks, and you can use it to work with the 'Di.Core.Di' outside the-  -- intended scope, you will have to remember to call 'Di.Monad.flush'-  -- yourself before exiting your application. Otherwise, some log messages may-  -- be left unprocessed. If possible, use the 'Di.Core.Di' within this function-  -- and don't let it escape this scope.+  -- /WARNING:/ Even while @'new' commit 'pure' :: m ('Di.Core.Di' 'Df1.Level'+  -- 'Df1.Path' 'Df1.Message')@ type-checks, and you can use it to work with the+  -- 'Di.Core.Di' outside the intended scope, you will have to remember to call+  -- 'Di.Monad.flush' yourself before exiting your application. Otherwise, some+  -- log messages may be left unprocessed. If possible, use the 'Di.Core.Di'+  -- within this function and don't let it escape this scope.   -> m a -- ^ new act = do   commit <- Di.Handle.stderr Di.Df1.df1