log-effect 0.4.0.0 → 0.4.0.1
raw patch · 2 files changed
+6/−2 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Control.Eff.Log: type Logger m l = forall v. Log l v -> m ()
Files
- log-effect.cabal +1/−1
- src/Control/Eff/Log.hs +5/−1
log-effect.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: log-effect-version: 0.4.0.0+version: 0.4.0.1 synopsis: An extensible log effect using extensible-effects description: Any help (especially documentation) is very welcome, homepage: https://github.com/ibotty/log-effect
src/Control/Eff/Log.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE TypeOperators #-} module Control.Eff.Log ( Log(Log, logLine)+ , Logger , logE , filterLog , filterLog'@@ -39,10 +40,12 @@ -- | a monadic action that does the real logging type Logger m l = forall v. Log l v -> m () +-- | Log something. logE :: (Typeable l, Member (Log l) r) => l -> Eff r () logE line = send $ \next -> inj (Log line (next ())) +-- | Collect log messages in a list. runLogPure :: (Typeable l) => Eff (Log l :> r) a -> Eff r (a, [l])@@ -52,6 +55,7 @@ performLog l = fmap (prefixLogWith l) (go (logNext l)) prefixLogWith log' (v, l) = (v, logLine log' : l) +-- | Run the 'Logger' action in the base monad for every log line. runLog :: (Typeable l, Typeable1 m, SetMember Lift (Lift m) r) => Logger m l -> Eff (Log l :> r) a -> Eff r a runLog logger = go . admin@@ -73,7 +77,7 @@ -- | Filter Log entries with a predicate and a proxy. ----- This is the same as 'filterLog' but with a "proxy l" for type inference.+-- This is the same as 'filterLog' but with a proxy l for type inference. filterLog' :: (Typeable l, Member (Log l) r) => (l -> Bool) -> proxy l -> Eff r a -> Eff r a filterLog' predicate _ = filterLog predicate