packages feed

yaml-pretty-extras 0.0.2.1 → 0.0.2.2

raw patch · 3 files changed

+12/−14 lines, 3 files

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for yaml-pretty-extras +## v0.0.2.2++Drop MonadThrow constraints from file IO functions+Drop decodeFileThrow, it's in upstream yaml now+ ## v0.0.2.1  Add lens helpers, transformFile, overFile, traverseOfFile, sanitizeFile
src/Data/Yaml/Pretty/Extras.hs view
@@ -19,7 +19,6 @@   , encodeFilePretty    -- * RIO Helpers (Codecs and Logging)-  , decodeFileThrow   , displayPrettyYaml   , decodeFileThrowLogged   , encodeFilePrettyLogged@@ -77,14 +76,9 @@ displayPrettyYaml :: ToPrettyYaml a => a -> Utf8Builder displayPrettyYaml = displayBytesUtf8 . toPrettyYaml --- | A version of Data.Yaml's decodeFileEither lifted to MonadThrow-decodeFileThrow :: (MonadIO m, FromJSON c, MonadThrow m) => FilePath -> m c-decodeFileThrow = liftIO . decodeFileEither >=> either throwM return- -- | decodeFileThrow with info logging, reports what was parsed via RIO's logInfo decodeFileThrowLogged   :: ( MonadReader env m-     , MonadThrow m      , MonadIO m      , HasLogFunc env      , FromJSON b@@ -109,7 +103,6 @@ -- | encodeFilePretty with info logging, reports what was saved to disk via RIO's logInfo encodeFilePrettyLogged   :: ( MonadReader env m-     , MonadThrow m      , MonadIO m      , HasLogFunc env      , ToPrettyYaml b@@ -133,7 +126,7 @@ -- | Run a function over a decoded file f and save the result to g, passthrough the new value.  transformFile-  :: (MonadIO m, FromJSON a1, MonadThrow m, ToPrettyYaml a2) =>+  :: (MonadIO m, FromJSON a1, ToPrettyYaml a2) =>       FilePath -> FilePath -> (a1 -> a2) -> m a2 transformFile f g l = do   (x :: a1) <- decodeFileThrow f@@ -148,21 +141,21 @@ -- | Perform a roundtrip decode/encode on a file to rearrange field order. Doesn't change the type.  sanitizeFile-  :: (MonadIO m, FromJSON a, MonadThrow m, ToPrettyYaml a) =>+  :: (MonadIO m, FromJSON a, ToPrettyYaml a) =>      FilePath -> m a sanitizeFile = flip (inplace transformFile) id  -- | Uses a lens over to modify a file, passthrough the new value.  overFile-  :: (MonadIO m, FromJSON a1, MonadThrow m, ToPrettyYaml a2) =>+  :: (MonadIO m, FromJSON a1, ToPrettyYaml a2) =>      FilePath -> FilePath -> ASetter a1 a2 a b -> (a -> b) -> m a2 overFile f g l a = transformFile f g (over l a)  -- | Use a lens traverseOf to modify a file, passthrough the new value.  traverseOfFile-  :: (MonadIO m, FromJSON a1, MonadThrow m, ToPrettyYaml a2) =>+  :: (MonadIO m, FromJSON a1, ToPrettyYaml a2) =>      FilePath -> FilePath -> LensLike m a1 a2 b1 b2 -> (b1 -> m b2) -> m a2 traverseOfFile f g l a = do   (x :: a1) <- decodeFileThrow f
yaml-pretty-extras.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 30a719434a8c574644339e466446c2756dcb9b3b71213d82bd7a55dc77c157c1+-- hash: e0a572e8f1e80d7ece96a64b50bb8bd5bdafdf0b3e9931459c5de2bb55fdd7ef  name:           yaml-pretty-extras-version:        0.0.2.1+version:        0.0.2.2 synopsis:       Extra functionality for pretty printing Yaml documents. description:    Extra functionality for pretty printing Yaml documents. Allows precise field ordering. category:       Data@@ -18,6 +18,7 @@ cabal-version:  >= 1.10 extra-source-files:     ChangeLog.md+    LICENSE     README.md  source-repository head@@ -53,6 +54,5 @@     , hspec     , microlens-platform     , rio-    , yaml     , yaml-pretty-extras   default-language: Haskell2010