on master help sign in
Version bump for #66
bd682eeMichael Snoyman
ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 0.8.13
2+
3+* Pretty module [#66](https://github.com/snoyberg/yaml/pull/66)
4+
1## 0.8.12
5## 0.8.12
2
6
3* Proper handling of `String "+123"` [#64](https://github.com/snoyberg/yaml/issues/64)
7* Proper handling of `String "+123"` [#64](https://github.com/snoyberg/yaml/issues/64)
Data/Yaml/Pretty.hs+12
@@ -1,4 +1,6 @@
1-- | Prettier YAML encoding.
1-- | Prettier YAML encoding.
2+--
3+-- Since 0.8.13
2module Data.Yaml.Pretty
4module Data.Yaml.Pretty
3 ( encodePretty
5 ( encodePretty
4 , Config
6 , Config
@@ -18,17 +20,25 @@ import Data.List (sortBy)
18import Data.ByteString (ByteString)
20import Data.ByteString (ByteString)
19import Prelude hiding (null)
21import Prelude hiding (null)
20
22
23+-- |
24+-- Since 0.8.13
21data Config = Config
25data Config = Config
22 { confCompare :: Text -> Text -> Ordering -- ^ Function used to sort keys in objects
26 { confCompare :: Text -> Text -> Ordering -- ^ Function used to sort keys in objects
23 }
27 }
24
28
25-- | The default configuration: do not sort objects.
29-- | The default configuration: do not sort objects.
30+--
31+-- Since 0.8.13
26defConfig :: Config
32defConfig :: Config
27defConfig = Config mempty
33defConfig = Config mempty
28
34
35+-- |
36+-- Since 0.8.13
29getConfCompare :: Config -> Text -> Text -> Ordering
37getConfCompare :: Config -> Text -> Text -> Ordering
30getConfCompare = confCompare
38getConfCompare = confCompare
31
39
40+-- |
41+-- Since 0.8.13
32setConfCompare :: (Text -> Text -> Ordering) -> Config -> Config
42setConfCompare :: (Text -> Text -> Ordering) -> Config -> Config
33setConfCompare cmp c = c { confCompare = cmp }
43setConfCompare cmp c = c { confCompare = cmp }
34
44
@@ -42,5 +52,7 @@ pretty cfg = go
42 go (Bool b) = bool b
52 go (Bool b) = bool b
43
53
44-- | Configurable 'encode'.
54-- | Configurable 'encode'.
55+--
56+-- Since 0.8.13
45encodePretty :: ToJSON a => Config -> a -> ByteString
57encodePretty :: ToJSON a => Config -> a -> ByteString
46encodePretty cfg = toByteString . pretty cfg . toJSON
58encodePretty cfg = toByteString . pretty cfg . toJSON
yaml.cabal+1−1
@@ -1,5 +1,5 @@
1name: yaml
1name: yaml
2−version: 0.8.12
2+version: 0.8.13
3license: BSD3
3license: BSD3
4license-file: LICENSE
4license-file: LICENSE
5author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
5author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov