on master help sign in
Merge pull request #50 from bitemyapp/master

Don't need Monoid, Semigroup suffices

commit8bc5270cfcb70fa5651356355ed6b1e37c0a553b authorMichael Xavier <michael@michaelxavier.net> dateThu 1 Jun 2017, 15:43 (9 years ago) parent79e21e398fec97
2 files changed+5−5
katip/src/Katip/Core.hs+1−1 katip/src/Katip/Monadic.hs+4−4
katip/src/Katip/Core.hs+1−1
@@ -493,7 +493,7 @@ itemJson verb a = toJSON $ a & itemPayload %~ payloadObject verb
493493-- Handle scribe does.
494494--
495495-- 2. Return a finalizing function that tells the scribe to shut
496−-- down. @katip-elasticsearch@'s @mkEsScribe@ returns a @IO (Scribe,
496+-- down. @katip-elasticsearch@'s @mkEsScribe@ returns an @IO (Scribe,
497497-- IO ())@. The finalizer will flush any queued log messages and shut
498498-- down gracefully before returning. This can be hooked into your
499499-- application's shutdown routine to ensure you never miss any log
katip/src/Katip/Monadic.hs+4−4
@@ -57,11 +57,11 @@ import Control.Monad.Trans.RWS (RWST)
5757import qualified Control.Monad.Trans.RWS.Strict as Strict (RWST)
5858import qualified Control.Monad.Trans.State.Strict as Strict (StateT)
5959import qualified Control.Monad.Trans.Writer.Strict as Strict (WriterT)
60−import Control.Monad.Writer
60+import Control.Monad.Writer hiding ((<>))
6161import Data.Aeson
6262import qualified Data.Foldable as FT
6363import qualified Data.HashMap.Strict as HM
64−import Data.Monoid as M
64+import Data.Semigroup as Semi
6565import Data.Sequence as Seq
6666import Data.Text (Text)
6767import Language.Haskell.TH
@@ -92,7 +92,7 @@ data AnyLogContext where
9292-- Additional note: you should not mappend LogContexts in any sort of
9393-- infinite loop, as it retains all data, so that would be a memory
9494-- leak.
95−newtype LogContexts = LogContexts (Seq AnyLogContext) deriving (Monoid)
95+newtype LogContexts = LogContexts (Seq AnyLogContext) deriving (Monoid, Semigroup)
9696
9797instance ToJSON LogContexts where
9898 toJSON (LogContexts cs) =
@@ -230,7 +230,7 @@ logExceptionM
230230logExceptionM action sev = action `catchAll` \e -> f e >> throwM e
231231 where
232232 f e = logFM sev (msg e)
233− msg e = ls ("An exception has occured: " :: Text) M.<> showLS e
233+ msg e = ls ("An exception has occured: " :: Text) Semi.<> showLS e
234234
235235
236236-------------------------------------------------------------------------------