Skip to content

Commit 3c69627

Browse files
chshershvrom911
authored andcommitted
Clean up before release (#171)
1 parent fefa4c5 commit 3c69627

File tree

7 files changed

+51
-11
lines changed

7 files changed

+51
-11
lines changed

co-log-core/CHANGELOG.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,27 @@
33
`co-log-core` uses [PVP Versioning][1].
44
The change log is available [on GitHub][2].
55

6-
## Unreleased
6+
## 0.2.1.0 — Jan 19, 2020
77

8+
* [#139](https://github.com/kowainik/co-log/issues/139):
9+
Add (unrepresentable) `Functor` instance for `LogAction` with the
10+
custom type-error.
11+
(by [@vrom911](https://github.com/vrom911))
12+
* [#148](https://github.com/kowainik/co-log/issues/148):
13+
Support GHC-8.8.2.
14+
(by [@chshersh](https://github.com/chshersh))
815
* [#122](https://github.com/kowainik/co-log/issues/122):
916
Add the `separate` combinator.
10-
* [#139](https://github.com/kowainik/co-log/issues/139):
11-
Add (unrepresentable) `Functor` instance for `LogAction` with the custom type-error.
17+
(by [@vrom911](https://github.com/vrom911))
18+
* [#125](https://github.com/kowainik/co-log/issues/125):
19+
Add monadic versions of contravariant functions.
20+
(by [@piq9117](https://github.com/piq9117))
21+
* [#138](https://github.com/kowainik/co-log/issues/138):
22+
Add `hoistLogAction` — higher-order transformation function.
23+
(by [@jiribenes](https://github.com/jiribenes))
24+
* [#123](https://github.com/kowainik/co-log/issues/123):
25+
Write default implementation to `getLogAction` via `logActionL`.
26+
(by [@SanchayanMaity](https://github.com/SanchayanMaity))
1227

1328
## 0.2.0.0 — May 5, 2019
1429

co-log-core/co-log-core.cabal

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extra-doc-files: CHANGELOG.md
3636
tested-with: GHC == 8.2.2
3737
GHC == 8.4.4
3838
GHC == 8.6.5
39-
GHC == 8.8.1
39+
GHC == 8.8.2
4040

4141
source-repository head
4242
type: git
@@ -53,10 +53,14 @@ common common-options
5353
-Wredundant-constraints
5454
-fhide-source-paths
5555
-freverse-errors
56+
if impl(ghc >= 8.8.1)
57+
ghc-options: -Wmissing-deriving-strategies
58+
-Werror=missing-deriving-strategies
5659

5760
default-language: Haskell2010
5861
default-extensions: ConstraintKinds
5962
DeriveGeneric
63+
DerivingStrategies
6064
GeneralizedNewtypeDeriving
6165
InstanceSigs
6266
LambdaCase

co-log-core/src/Colog/Core/Action.hs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ cfilter :: Applicative m => (msg -> Bool) -> LogAction m msg -> LogAction m msg
287287
cfilter predicate (LogAction action) = LogAction $ \a -> when (predicate a) (action a)
288288
{-# INLINE cfilter #-}
289289

290-
{- | Performs the given logging action only if satisfies the monadic predicate.
291-
292-
Let's say you want to only to see logs that happened on weekends.
290+
{- | Performs the given logging action only if satisfies the monadic
291+
predicate. Let's say you want to only to see logs that happened on
292+
weekends.
293293
294294
@
295295
isWeekendM :: MessageWithTimestamp -> IO Bool
@@ -299,8 +299,12 @@ And use it with 'cfilterM' like this
299299
300300
@
301301
logMessageAction :: 'LogAction' m MessageWithTimestamp
302+
303+
logWeekendAction :: 'LogAction' m MessageWithTimestamp
304+
logWeekendAction = cfilterM isWeekendM logMessageAction
302305
@
303306
307+
@since 0.2.1.0
304308
-}
305309
cfilterM :: Monad m => (msg -> m Bool) -> LogAction m msg -> LogAction m msg
306310
cfilterM predicateM (LogAction action) =
@@ -364,7 +368,11 @@ cmapMaybe :: Applicative m => (a -> Maybe b) -> LogAction m b -> LogAction m a
364368
cmapMaybe f (LogAction action) = LogAction (maybe (pure ()) action . f)
365369
{-# INLINE cmapMaybe #-}
366370

367-
-- | Similar to `cmapMaybe` but for convertions that may fail inside a monadic context.
371+
{- | Similar to `cmapMaybe` but for convertions that may fail inside a
372+
monadic context.
373+
374+
@since 0.2.1.0
375+
-}
368376
cmapMaybeM :: Monad m => (a -> m (Maybe b)) -> LogAction m b -> LogAction m a
369377
cmapMaybeM f (LogAction action) = LogAction (maybe (pure ()) action <=< f)
370378
{-# INLINE cmapMaybeM #-}
@@ -424,7 +432,6 @@ logTextAction :: 'LogAction' IO Text
424432
logTextAction = 'cmapM' withTime myAction
425433
@
426434
-}
427-
428435
cmapM :: Monad m => (a -> m b) -> LogAction m b -> LogAction m a
429436
cmapM f (LogAction action) = LogAction (f >=> action)
430437
{-# INLINE cmapM #-}
@@ -456,6 +463,10 @@ divide f (LogAction actionB) (LogAction actionC) = LogAction $ \(f -> (b, c)) ->
456463
actionB b *> actionC c
457464
{-# INLINE divide #-}
458465

466+
{- | Monadic version of 'divide'.
467+
468+
@since 0.2.1.0
469+
-}
459470
divideM :: (Monad m) => (a -> m (b, c)) -> LogAction m b -> LogAction m c -> LogAction m a
460471
divideM f (LogAction actionB) (LogAction actionC) =
461472
LogAction $ \(f -> mbc) -> mbc >>= (\(b, c) -> actionB b *> actionC c)
@@ -541,6 +552,10 @@ choose :: (a -> Either b c) -> LogAction m b -> LogAction m c -> LogAction m a
541552
choose f (LogAction actionB) (LogAction actionC) = LogAction (either actionB actionC . f)
542553
{-# INLINE choose #-}
543554

555+
{- | Monadic version of 'choose'.
556+
557+
@since 0.2.1.0
558+
-}
544559
chooseM :: Monad m => (a -> m (Either b c)) -> LogAction m b -> LogAction m c -> LogAction m a
545560
chooseM f (LogAction actionB) (LogAction actionC) = LogAction (either actionB actionC <=< f)
546561
{-# INLINE chooseM #-}
@@ -726,6 +741,8 @@ to a one that performs the logging in the 'IO' monad using:
726741
@
727742
hoistLogAction performPureLogsInIO :: LogAction (PureLogger a) a -> LogAction IO a
728743
@
744+
745+
@since 0.2.1.0
729746
-}
730747
hoistLogAction
731748
:: (forall x. m x -> n x)

co-log-core/src/Colog/Core/Class.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module Colog.Core.Class
2121
import Colog.Core.Action (LogAction)
2222
import Data.Functor.Const (Const (..))
2323

24+
2425
-- to inline lens better
2526
{- HLINT ignore "Redundant lambda" -}
2627

co-log-core/src/Colog/Core/IO.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import Colog.Core.Action (LogAction (..))
3333
import Control.Monad.IO.Class (MonadIO, liftIO)
3434
import System.IO (Handle, IOMode (AppendMode), hPrint, hPutStrLn, stderr, withFile)
3535

36+
3637
{- $setup
3738
>>> import Colog.Core.Action
3839
-}

co-log-core/src/Colog/Core/Severity.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import Data.Ix (Ix)
3737

3838
import Colog.Core.Action (LogAction (..), cfilter)
3939

40+
4041
-- | Severity for the log messages.
4142
data Severity
4243
{- | Information useful for debug purposes.
@@ -60,7 +61,7 @@ data Severity
6061
E.g. exceptional situations: couldn't syncronize accounts.
6162
-}
6263
| Error
63-
deriving (Show, Read, Eq, Ord, Enum, Bounded, Ix)
64+
deriving stock (Show, Read, Eq, Ord, Enum, Bounded, Ix)
6465

6566
{- $pattern
6667
Instead of using full names of the constructors you can instead use one-letter

co-log-core/test/Doctests.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ main :: IO ()
99
main = do
1010
sourceFiles <- glob "src/**/*.hs"
1111
doctest
12-
$ "-XInstanceSigs"
12+
$ "-XDerivingStrategies"
13+
: "-XInstanceSigs"
1314
: "-XScopedTypeVariables"
1415
: "-XViewPatterns"
1516
: sourceFiles

0 commit comments

Comments
 (0)