Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libyaml/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for libyaml

## 0.1.5

* Add lenses for `FormatOptions`

## 0.1.4

* Use libyaml-clib for the cbits
Expand Down
4 changes: 2 additions & 2 deletions libyaml/libyaml.cabal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.39.1.
--
-- see: https://github.com/sol/hpack

name: libyaml
version: 0.1.4
version: 0.1.5
synopsis: Low-level, streaming YAML interface.
description: README and API documentation are available at <https://www.stackage.org/package/libyaml>
category: Text
Expand Down
2 changes: 1 addition & 1 deletion libyaml/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: libyaml
version: 0.1.4
version: 0.1.5
synopsis: Low-level, streaming YAML interface.
description: README and API documentation are available at <https://www.stackage.org/package/libyaml>
category: Text
Expand Down
14 changes: 14 additions & 0 deletions libyaml/src/Text/Libyaml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module Text.Libyaml
, defaultFormatOptions
, setWidth
, setTagRendering
, widthL
, tagRenderingL
, renderScalarTags
, renderAllTags
, renderNoTags
Expand Down Expand Up @@ -759,6 +761,18 @@ setWidth w opts = opts { formatOptionsWidth = w }
setTagRendering :: (Event -> TagRender) -> FormatOptions -> FormatOptions
setTagRendering f opts = opts { formatOptionsRenderTags = f }

-- | van Laarhoven-encoded lens for `FormatOptions` @width@
--
-- @since 0.1.5
widthL :: forall f. Functor f => (Maybe Int -> f (Maybe Int)) -> FormatOptions -> f FormatOptions
widthL f s = (\a -> s {formatOptionsWidth = a}) <$> f (formatOptionsWidth s)

-- | van Laarhoven-encoded lens for `FormatOptions` @tagRendering@
--
-- @since 0.1.5
tagRenderingL :: forall f. Functor f => ((Event -> TagRender) -> f (Event -> TagRender)) -> FormatOptions -> f FormatOptions
tagRenderingL f s = (\a -> s {formatOptionsRenderTags = a}) <$> f (formatOptionsRenderTags s)

encode :: MonadResource m => ConduitM Event o m ByteString
encode = encodeWith defaultFormatOptions

Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-22.13
resolver: lts-24.57

flags:
yaml:
Expand Down
4 changes: 4 additions & 0 deletions yaml/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChangeLog for yaml

## 0.11.12.0

* Add lenses for `EncodeOptions`

## 0.11.11.2

* Compat with aeson 2.2
Expand Down
2 changes: 1 addition & 1 deletion yaml/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: yaml
version: 0.11.11.2
version: 0.11.12.0
synopsis: Support for parsing and rendering YAML documents.
description: README and API documentation are available at <https://www.stackage.org/package/yaml>
category: Data
Expand Down
16 changes: 16 additions & 0 deletions yaml/src/Data/Yaml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ module Data.Yaml
, defaultStringStyle
, setStringStyle
, setFormat
, stringStyleL
, formatL
, FormatOptions
, defaultFormatOptions
, setWidth
, widthL
, tagRenderingL
-- * Deprecated
, decode
, decodeFile
Expand Down Expand Up @@ -141,6 +145,18 @@ setStringStyle s opts = opts { encodeOptionsStringStyle = s }
setFormat :: FormatOptions -> EncodeOptions -> EncodeOptions
setFormat f opts = opts { encodeOptionsFormat = f }

-- | van Laarhoven-encoded lens for `EncodeOptions` @stringStyle@
--
-- @since 0.11.12.0
stringStyleL :: forall f. Functor f => (StringStyle -> f StringStyle) -> EncodeOptions -> f EncodeOptions
stringStyleL f s = (\a -> s {encodeOptionsStringStyle = a}) <$> f (encodeOptionsStringStyle s)

-- | van Laarhoven-encoded lens for `EncodeOptions` @format@
--
-- @since 0.11.12.0
formatL :: forall f. Functor f => (FormatOptions -> f FormatOptions) -> EncodeOptions -> f EncodeOptions
formatL f s = (\a -> s {encodeOptionsFormat = a}) <$> f (encodeOptionsFormat s)

-- |
-- @since 0.10.2.0
data EncodeOptions = EncodeOptions
Expand Down
4 changes: 2 additions & 2 deletions yaml/yaml.cabal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.1.
-- This file has been generated from package.yaml by hpack version 0.39.1.
--
-- see: https://github.com/sol/hpack

name: yaml
version: 0.11.11.2
version: 0.11.12.0
synopsis: Support for parsing and rendering YAML documents.
description: README and API documentation are available at <https://www.stackage.org/package/yaml>
category: Data
Expand Down