Skip to content

Commit

Permalink
Version bump for #66
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Aug 13, 2015
1 parent 5fa9d63 commit bd682ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog.md
@@ -1,3 +1,7 @@
## 0.8.13

* Pretty module [#66](https://github.com/snoyberg/yaml/pull/66)

## 0.8.12

* Proper handling of `String "+123"` [#64](https://github.com/snoyberg/yaml/issues/64)
Expand Down
12 changes: 12 additions & 0 deletions Data/Yaml/Pretty.hs
@@ -1,4 +1,6 @@
-- | Prettier YAML encoding.
--
-- Since 0.8.13
module Data.Yaml.Pretty
( encodePretty
, Config
Expand All @@ -18,17 +20,25 @@ import Data.List (sortBy)
import Data.ByteString (ByteString)
import Prelude hiding (null)

-- |
-- Since 0.8.13
data Config = Config
{ confCompare :: Text -> Text -> Ordering -- ^ Function used to sort keys in objects
}

-- | The default configuration: do not sort objects.
--
-- Since 0.8.13
defConfig :: Config
defConfig = Config mempty

-- |
-- Since 0.8.13
getConfCompare :: Config -> Text -> Text -> Ordering
getConfCompare = confCompare

-- |
-- Since 0.8.13
setConfCompare :: (Text -> Text -> Ordering) -> Config -> Config
setConfCompare cmp c = c { confCompare = cmp }

Expand All @@ -42,5 +52,7 @@ pretty cfg = go
go (Bool b) = bool b

-- | Configurable 'encode'.
--
-- Since 0.8.13
encodePretty :: ToJSON a => Config -> a -> ByteString
encodePretty cfg = toByteString . pretty cfg . toJSON
2 changes: 1 addition & 1 deletion yaml.cabal
@@ -1,5 +1,5 @@
name: yaml
version: 0.8.12
version: 0.8.13
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
Expand Down

0 comments on commit bd682ee

Please sign in to comment.