packages feed

hw-polysemy 0.2.14.1 → 0.2.14.2

raw patch · 2 files changed

+49/−5 lines, 2 filesdep ~hedgehogdep ~mtlPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hedgehog, mtl

API changes (from Hackage documentation)

Files

core/HaskellWorks/Polysemy/Log.hs view
@@ -11,8 +11,16 @@ module HaskellWorks.Polysemy.Log   ( interpretDataLogNoop,     interpretDataLogLocalNoop,+    interpretDataLogToJsonStdout,+    logEntryToJson,+    logMessageToJson,   ) where +import           Data.Aeson+import qualified Data.Aeson                  as J+import qualified Data.ByteString.Lazy        as LBS+import qualified Data.Text.Encoding          as T+import qualified GHC.Stack                   as GHC import           HaskellWorks.Prelude import           Polysemy import           Polysemy.Internal.Tactics   (liftT)@@ -34,3 +42,39 @@     Log.Local f ma ->       raise . interpretDataLogLocalNoop (f . context) =<< runT ma {-# inline interpretDataLogLocalNoop #-}++interpretDataLogToJsonStdout :: ()+  => Member (Embed IO) r+  => (e -> J.Value)+  -> Sem (DataLog e : r) a+  -> Sem r a+interpretDataLogToJsonStdout toJson =+  interpretDataLogStdoutWith (T.decodeUtf8 . LBS.toStrict . J.encode . toJson)++logEntryToJson :: (a -> Value) -> LogEntry a -> Value+logEntryToJson aToJson (LogEntry value time callstack) =+    object+      [ "time" .= time+      , "data" .= aToJson value+      , "callstack" .= fmap callsiteToJson (GHC.getCallStack callstack)+      ]+    where+      callsiteToJson :: ([Char], GHC.SrcLoc) -> Value+      callsiteToJson (caller, srcLoc) =+        object+          [ "caller"    .= caller+          , "package"   .= GHC.srcLocPackage srcLoc+          , "module"    .= GHC.srcLocModule srcLoc+          , "file"      .= GHC.srcLocFile srcLoc+          , "startLine" .= GHC.srcLocStartLine srcLoc+          , "startCol"  .= GHC.srcLocStartCol srcLoc+          , "endLine"   .= GHC.srcLocEndLine srcLoc+          , "endCol"    .= GHC.srcLocEndCol srcLoc+          ]++logMessageToJson :: LogMessage -> Value+logMessageToJson (LogMessage severity message) =+    object+      [ "severity" .= show severity+      , "message"  .= message+      ]
hw-polysemy.cabal view
@@ -1,6 +1,6 @@ cabal-version:          3.4 name:                   hw-polysemy-version:                0.2.14.1+version:                0.2.14.2 synopsis:               Opinionated polysemy library description:            Opinionated polysemy library. license:                Apache-2.0@@ -33,11 +33,11 @@ common filepath                   { build-depends: filepath                                    < 1.6    } common generic-lens               { build-depends: generic-lens                                < 2.3    } common ghc-prim                   { build-depends: ghc-prim                                    < 0.12   }+common hedgehog                   { build-depends: hedgehog                                    < 1.6    } common http-conduit               { build-depends: http-conduit               >= 2.3        && < 2.4    }-common hedgehog                   { build-depends: hedgehog                                    < 1.5    }-common network                    { build-depends: network                                     < 3.3    } common lens                       { build-depends: lens                                        < 5.4    }-common mtl                        { build-depends: mtl                                         < 5.4    }+common mtl                        { build-depends: mtl                                         < 2.4    }+common network                    { build-depends: network                                     < 3.3    } common polysemy                   { build-depends: polysemy                                    < 2      } common polysemy-log               { build-depends: polysemy-log               >= 0.11       && < 1      } common polysemy-plugin            { build-depends: polysemy-plugin                             < 0.5    }@@ -50,8 +50,8 @@ common tasty-discover             { build-depends: tasty-discover                              < 6      } common tasty-hedgehog             { build-depends: tasty-hedgehog                              < 1.5    } common temporary                  { build-depends: temporary                                   < 1.4    }-common text                       { build-depends: text                                        < 3      } common testcontainers             { build-depends: testcontainers                              < 0.6    }+common text                       { build-depends: text                                        < 3      } common time                       { build-depends: time                                        < 2      } common transformers               { build-depends: transformers                                < 0.7    } common unliftio                   { build-depends: unliftio                                    < 0.3    }