on master help sign in
Merge pull request #160 from afranchuk/master

Close #145. Create a separate libyaml package.

commitf708fe0b34441ec74d6085eaf1201b2c4830cea4 authorMichael Snoyman <michael@snoyman.com> dateFri 12 Oct 2018, 09:00 (8 years ago) parent7682a3c6962aca
62 files changed+171−77
.gitmodules+1−1 README.md+14−13 copy-libyaml.sh−10 libyaml/.gitignore+3 libyaml/ChangeLog.md+6 libyaml/LICENSE+22−17 Makefile → libyaml/Makefile libyaml/README.md+3 libyaml/Setup.hs+2 c/helper.c → libyaml/c/helper.c c/helper.h → libyaml/c/helper.h libyaml/copy-libyaml.sh+10 libyaml/libyaml_src/LICENSE+20 libyaml/api.c → libyaml/libyaml_src/api.c libyaml/dumper.c → libyaml/libyaml_src/dumper.c libyaml/emitter.c → libyaml/libyaml_src/emitter.c libyaml/loader.c → libyaml/libyaml_src/loader.c libyaml/parser.c → libyaml/libyaml_src/parser.c libyaml/reader.c → libyaml/libyaml_src/reader.c libyaml/scanner.c → libyaml/libyaml_src/scanner.c libyaml/writer.c → libyaml/libyaml_src/writer.c libyaml/yaml.h → libyaml/libyaml_src/yaml.h libyaml/yaml_private.h → libyaml/libyaml_src/yaml_private.h libyaml/package.yaml+62 src/Text/Libyaml.hs → libyaml/src/Text/Libyaml.hs vendor/libyaml → libyaml/vendor/libyaml stack.yaml+4 ChangeLog.md → yaml/ChangeLog.md+4 LICENSE → yaml/LICENSE yaml/README.md+18 Setup.lhs → yaml/Setup.lhs builder-test.hs → yaml/builder-test.hs examples/Config.hs → yaml/examples/Config.hs examples/Main.hs → yaml/examples/Main.hs examples/Simple.hs → yaml/examples/Simple.hs exe/json2yaml.hs → yaml/exe/json2yaml.hs exe/yaml2json.hs → yaml/exe/yaml2json.hs package.yaml → yaml/package.yaml+2−36 parser-test.hs → yaml/parser-test.hs src/Data/Yaml.hs → yaml/src/Data/Yaml.hs src/Data/Yaml/Aeson.hs → yaml/src/Data/Yaml/Aeson.hs src/Data/Yaml/Builder.hs → yaml/src/Data/Yaml/Builder.hs src/Data/Yaml/Config.hs → yaml/src/Data/Yaml/Config.hs src/Data/Yaml/Include.hs → yaml/src/Data/Yaml/Include.hs src/Data/Yaml/Internal.hs → yaml/src/Data/Yaml/Internal.hs src/Data/Yaml/Parser.hs → yaml/src/Data/Yaml/Parser.hs src/Data/Yaml/Pretty.hs → yaml/src/Data/Yaml/Pretty.hs src/Data/Yaml/TH.hs → yaml/src/Data/Yaml/TH.hs test/Data/Yaml/IncludeSpec.hs → yaml/test/Data/Yaml/IncludeSpec.hs test/Data/Yaml/THSpec.hs → yaml/test/Data/Yaml/THSpec.hs test/Data/YamlSpec.hs → yaml/test/Data/YamlSpec.hs test/Spec.hs → yaml/test/Spec.hs test/json.yaml → yaml/test/json.yaml test/largest-string.yaml → yaml/test/largest-string.yaml test/resources/accent/foo.yaml → yaml/test/resources/accent/foo.yaml test/resources/bar.yaml → yaml/test/resources/bar.yaml test/resources/baz.yaml → yaml/test/resources/baz.yaml test/resources/empty.yaml → yaml/test/resources/empty.yaml test/resources/empty2.yaml → yaml/test/resources/empty2.yaml test/resources/foo.yaml → yaml/test/resources/foo.yaml test/resources/loop/bar.yaml → yaml/test/resources/loop/bar.yaml test/resources/loop/foo.yaml → yaml/test/resources/loop/foo.yaml
.gitmodules+1−1
@@ -1,3 +1,3 @@
11[submodule "vendor/libyaml"]
2− path = vendor/libyaml
2+ path = libyaml/vendor/libyaml
33 url = https://github.com/snoyberg/libyaml
README.md+14−13
@@ -1,20 +1,21 @@
1−## yaml
1+# YAML Haskell Library
22
3−[![Build Status](https://travis-ci.org/snoyberg/yaml.svg?branch=master)](https://travis-ci.org/snoyberg/yaml)
4−[![Build status](https://ci.appveyor.com/api/projects/status/hqy2jketp8m502so/branch/master?svg=true)](https://ci.appveyor.com/project/snoyberg/yaml/branch/master)
3+This project contains two haskell packages: `yaml` for higher-level parsing and writing of yaml documents, and `libyaml`
4+for lower-level event-based streaming.
55
6−Provides support for parsing and emitting Yaml documents.
6+## `yaml` Package
77
8−This package includes the [full libyaml C library version 0.2.1 by Kirill Simonov](https://github.com/yaml/libyaml) in the package so you don't need to worry about any non-Haskell dependencies.
8+`yaml` provides a high-level interface based around the JSON datatypes provided by the `aeson` package. This allows
9+using JSON and YAML interchangeably in your code with the `aeson` typeclasses. See the
10+[yaml README](https://github.com/snoyberg/yaml/tree/master/libyaml/README.md) for more details.
911
10−The package is broken down into two primary modules. `Data.Yaml` provides a high-level interface based around the JSON datatypes provided by the `aeson` package. `Text.Libyaml` provides a lower-level, streaming interface. For most users, `Data.Yaml` is recommended.
12+## `libyaml` Package
1113
12−### Examples
14+`libyaml` is a wrapper over the libyaml C library (and includes the source so no external library is needed). It is an
15+event-based streaming API. See the [libyaml README](https://github.com/snoyberg/yaml/tree/master/libyaml/README.md) for
16+more details.
1317
14−Usage examples can be found in the `Data.Yaml` documentation or in the [examples](https://github.com/snoyberg/yaml/tree/master/examples) directory.
18+## License
1519
16−### Additional modules
17−
18−* `Data.Yaml.Include` supports adding `!include` directives to your YAML files.
19−* `Data.Yaml.Builder` and `Data.Yaml.Parser` allow more fine-grained control of parsing an rendering, as opposed to just using the aeson typeclass and datatype system for parsing and rendering.
20−* `Data.Yaml.Aeson` is currently a re-export of `Data.Yaml` to explicitly choose to use the aeson-compatible API.
20+This project is licensed with the BSD 3-Clause license. Copies of the license can be found in both the `yaml` and
21+`libyaml` subdirectories
copy-libyaml.shdeleted−10
@@ -1,10 +0,0 @@
1−#!/usr/bin/env bash
2−
3−set -ex
4−
5−rm -rf libyaml
6−mkdir -p libyaml
7−cp vendor/libyaml/LICENSE libyaml
8−cp vendor/libyaml/src/*.c libyaml
9−cp vendor/libyaml/src/*.h libyaml
10−cp vendor/libyaml/include/*.h libyaml
libyaml/.gitignorenew file+3
@@ -0,0 +1,3 @@
1+.stack-work/
2+libyaml.cabal
3+*~
libyaml/ChangeLog.mdnew file+6
@@ -0,0 +1,6 @@
1+# Changelog for libyaml
2+
3+## 0.1.0.0
4+
5+* Split `libyaml` into a separate package from `yaml`. This split occurred at
6+ `yaml` version 0.10.4.0.
libyaml/LICENSE+22−17
@@ -1,20 +1,25 @@
1−Copyright (c) 2017-2018 Ingy döt Net
2−Copyright (c) 2006-2016 Kirill Simonov
1+The following license covers this documentation, and the source code, except
2+where otherwise indicated.
33
4−Permission is hereby granted, free of charge, to any person obtaining a copy of
5−this software and associated documentation files (the "Software"), to deal in
6−the Software without restriction, including without limitation the rights to
7−use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8−of the Software, and to permit persons to whom the Software is furnished to do
9−so, subject to the following conditions:
4+Copyright 2008, Michael Snoyman. All rights reserved.
105
11−The above copyright notice and this permission notice shall be included in all
12−copies or substantial portions of the Software.
6+Redistribution and use in source and binary forms, with or without
7+modification, are permitted provided that the following conditions are met:
138
14−THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15−IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16−FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17−AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18−LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19−OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20−SOFTWARE.
9+* Redistributions of source code must retain the above copyright notice, this
10+ list of conditions and the following disclaimer.
11+
12+* Redistributions in binary form must reproduce the above copyright notice,
13+ this list of conditions and the following disclaimer in the documentation
14+ and/or other materials provided with the distribution.
15+
16+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
17+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Makefile → libyaml/Makefilerenamed

The content is the same.

libyaml/README.mdnew file+3
@@ -0,0 +1,3 @@
1+# libyaml
2+
3+This package provides a haskell wrapper over the [libyaml C library version 0.2.1 by Kirill Simonov](https://github.com/yaml/libyaml). It contains the C source so you don't need to worry about any non-Haskell dependencies.
libyaml/Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
c/helper.c → libyaml/c/helper.crenamed

The content is the same.

c/helper.h → libyaml/c/helper.hrenamed

The content is the same.

libyaml/copy-libyaml.shnew file+10
@@ -0,0 +1,10 @@
1+#!/usr/bin/env bash
2+
3+set -ex
4+
5+rm -rf libyaml_src
6+mkdir -p libyaml_src
7+cp vendor/libyaml/LICENSE libyaml_src
8+cp vendor/libyaml/src/*.c libyaml_src
9+cp vendor/libyaml/src/*.h libyaml_src
10+cp vendor/libyaml/include/*.h libyaml_src
libyaml/libyaml_src/LICENSEnew file+20
@@ -0,0 +1,20 @@
1+Copyright (c) 2017-2018 Ingy döt Net
2+Copyright (c) 2006-2016 Kirill Simonov
3+
4+Permission is hereby granted, free of charge, to any person obtaining a copy of
5+this software and associated documentation files (the "Software"), to deal in
6+the Software without restriction, including without limitation the rights to
7+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+of the Software, and to permit persons to whom the Software is furnished to do
9+so, subject to the following conditions:
10+
11+The above copyright notice and this permission notice shall be included in all
12+copies or substantial portions of the Software.
13+
14+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+SOFTWARE.
libyaml/api.c → libyaml/libyaml_src/api.crenamed

The content is the same.

libyaml/dumper.c → libyaml/libyaml_src/dumper.crenamed

The content is the same.

libyaml/emitter.c → libyaml/libyaml_src/emitter.crenamed

The content is the same.

libyaml/loader.c → libyaml/libyaml_src/loader.crenamed

The content is the same.

libyaml/parser.c → libyaml/libyaml_src/parser.crenamed

The content is the same.

libyaml/reader.c → libyaml/libyaml_src/reader.crenamed

The content is the same.

libyaml/scanner.c → libyaml/libyaml_src/scanner.crenamed

The content is the same.

libyaml/writer.c → libyaml/libyaml_src/writer.crenamed

The content is the same.

libyaml/yaml.h → libyaml/libyaml_src/yaml.hrenamed

The content is the same.

libyaml/yaml_private.h → libyaml/libyaml_src/yaml_private.hrenamed

The content is the same.

libyaml/package.yamlnew file+62
@@ -0,0 +1,62 @@
1+name: libyaml
2+version: 0.1.0.0
3+synopsis: Low-level, streaming YAML interface.
4+description: README and API documentation are available at <https://www.stackage.org/package/libyaml>
5+category: Text
6+author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
7+maintainer: Michael Snoyman <michael@snoyman.com>
8+license: BSD3
9+github: snoyberg/yaml
10+stability: stable
11+
12+extra-source-files:
13+- c/helper.h
14+- libyaml_src/yaml_private.h
15+- libyaml_src/yaml.h
16+- libyaml_src/LICENSE
17+- README.md
18+- ChangeLog.md
19+
20+flags:
21+ system-libyaml:
22+ description: Use the system-wide libyaml instead of the bundled copy
23+ manual: false
24+ default: false
25+ no-unicode:
26+ description: Don't enable unicode output. Instead, unicode characters will be escaped.
27+ manual: false
28+ default: false
29+
30+dependencies:
31+- base >=4.9.1 && <5 # GHC 8.0.2 and later
32+- bytestring >=0.9.1.4
33+- conduit >=1.2.8 && <1.4
34+- resourcet >=0.3 && <1.3
35+
36+library:
37+ c-sources: c/helper.c
38+ ghc-options: -Wall
39+ include-dirs:
40+ - c
41+ source-dirs: src
42+ when:
43+ - condition: flag(no-unicode)
44+ cpp-options: -D__NO_UNICODE__
45+ - condition: ! '!(flag(system-libyaml))'
46+ then:
47+ c-sources:
48+ - libyaml_src/api.c
49+ - libyaml_src/dumper.c
50+ - libyaml_src/emitter.c
51+ - libyaml_src/loader.c
52+ - libyaml_src/parser.c
53+ - libyaml_src/reader.c
54+ - libyaml_src/scanner.c
55+ - libyaml_src/writer.c
56+ include-dirs:
57+ - libyaml_src
58+ else:
59+ extra-libraries: yaml
60+ - condition: os(windows)
61+ cpp-options: -DWINDOWS
62+
src/Text/Libyaml.hs → libyaml/src/Text/Libyaml.hsrenamed

The content is the same.

vendor/libyaml → libyaml/vendor/libyamlrenamed

The content is the same.

stack.yaml+4
@@ -3,3 +3,7 @@ resolver: lts-11.10
33flags:
44 yaml:
55 no-examples: false
6+
7+packages:
8+ - yaml
9+ - libyaml
ChangeLog.md → yaml/ChangeLog.mdrenamed+4
@@ -1,5 +1,9 @@
11# ChangeLog for yaml
22
3+## 0.11.0.0
4+
5+* Split out the `libyaml` and `Text.Libyaml` code into its own package. [#145](https://github.com/snoyberg/yaml/issues/145)
6+
37## 0.10.4.0
48
59* Add `decodeMarked` and `decodeFileMarked` functions to `Text.Libyaml`, and
LICENSE → yaml/LICENSErenamed

The content is the same.

yaml/README.mdnew file+18
@@ -0,0 +1,18 @@
1+## yaml
2+
3+[![Build Status](https://travis-ci.org/snoyberg/yaml.svg?branch=master)](https://travis-ci.org/snoyberg/yaml)
4+[![Build status](https://ci.appveyor.com/api/projects/status/hqy2jketp8m502so/branch/master?svg=true)](https://ci.appveyor.com/project/snoyberg/yaml/branch/master)
5+
6+Provides support for parsing and emitting Yaml documents.
7+
8+`Data.Yaml` provides a high-level interface based around the JSON datatypes provided by the `aeson` package. It uses `Text.Libyaml` from `libyaml` in its implementation of the low-level yaml encoder/decoder.
9+
10+### Examples
11+
12+Usage examples can be found in the `Data.Yaml` documentation or in the [examples](https://github.com/snoyberg/yaml/tree/master/yaml/examples) directory.
13+
14+### Additional `yaml` modules
15+
16+* `Data.Yaml.Include` supports adding `!include` directives to your YAML files.
17+* `Data.Yaml.Builder` and `Data.Yaml.Parser` allow more fine-grained control of parsing an rendering, as opposed to just using the aeson typeclass and datatype system for parsing and rendering.
18+* `Data.Yaml.Aeson` is currently a re-export of `Data.Yaml` to explicitly choose to use the aeson-compatible API.
Setup.lhs → yaml/Setup.lhsrenamed

The content is the same.

builder-test.hs → yaml/builder-test.hsrenamed

The content is the same.

examples/Config.hs → yaml/examples/Config.hsrenamed

The content is the same.

examples/Main.hs → yaml/examples/Main.hsrenamed

The content is the same.

examples/Simple.hs → yaml/examples/Simple.hsrenamed

The content is the same.

exe/json2yaml.hs → yaml/exe/json2yaml.hsrenamed

The content is the same.

exe/yaml2json.hs → yaml/exe/yaml2json.hsrenamed

The content is the same.

package.yaml → yaml/package.yamlrenamed+2−36
@@ -1,5 +1,5 @@
11name: yaml
2−version: 0.10.4.0
2+version: 0.11.0.0
33synopsis: Support for parsing and rendering YAML documents.
44description: README and API documentation are available at <https://www.stackage.org/package/yaml>
55category: Data
@@ -10,10 +10,6 @@ github: snoyberg/yaml
1010stability: stable
1111
1212extra-source-files:
13−- c/helper.h
14−- libyaml/yaml_private.h
15−- libyaml/yaml.h
16−- libyaml/LICENSE
1713- test/largest-string.yaml
1814- test/json.yaml
1915- test/resources/foo.yaml
@@ -36,14 +32,6 @@ flags:
3632 description: don't build the examples
3733 manual: false
3834 default: true
39− system-libyaml:
40− description: Use the system-wide libyaml instead of the bundled copy
41− manual: false
42− default: false
43− no-unicode:
44− description: Don't enable unicode output. Instead, unicode characters will be escaped.
45− manual: false
46− default: false
4735
4836dependencies:
4937- base >=4.9.1 && <5 # GHC 8.0.2 and later
@@ -62,39 +50,17 @@ dependencies:
6250- filepath
6351- directory
6452- template-haskell
53+- libyaml >=0.1 && <0.2
6554when:
6655 condition: "!impl(ghc >= 8.0)"
6756 dependencies:
6857 - semigroups
6958
7059library:
71− c-sources: c/helper.c
7260 other-extensions:
7361 - LambdaCase
7462 ghc-options: -Wall
75− include-dirs:
76− - c
7763 source-dirs: src
78− when:
79− - condition: flag(no-unicode)
80− cpp-options: -D__NO_UNICODE__
81− - condition: ! '!(flag(system-libyaml))'
82− then:
83− c-sources:
84− - libyaml/api.c
85− - libyaml/dumper.c
86− - libyaml/emitter.c
87− - libyaml/loader.c
88− - libyaml/parser.c
89− - libyaml/reader.c
90− - libyaml/scanner.c
91− - libyaml/writer.c
92− include-dirs:
93− - libyaml
94− else:
95− extra-libraries: yaml
96− - condition: os(windows)
97− cpp-options: -DWINDOWS
9864
9965executables:
10066 json2yaml:
parser-test.hs → yaml/parser-test.hsrenamed

The content is the same.

src/Data/Yaml.hs → yaml/src/Data/Yaml.hsrenamed

The content is the same.

src/Data/Yaml/Aeson.hs → yaml/src/Data/Yaml/Aeson.hsrenamed

The content is the same.

src/Data/Yaml/Builder.hs → yaml/src/Data/Yaml/Builder.hsrenamed

The content is the same.

src/Data/Yaml/Config.hs → yaml/src/Data/Yaml/Config.hsrenamed

The content is the same.

src/Data/Yaml/Include.hs → yaml/src/Data/Yaml/Include.hsrenamed

The content is the same.

src/Data/Yaml/Internal.hs → yaml/src/Data/Yaml/Internal.hsrenamed

The content is the same.

src/Data/Yaml/Parser.hs → yaml/src/Data/Yaml/Parser.hsrenamed

The content is the same.

src/Data/Yaml/Pretty.hs → yaml/src/Data/Yaml/Pretty.hsrenamed

The content is the same.

src/Data/Yaml/TH.hs → yaml/src/Data/Yaml/TH.hsrenamed

The content is the same.

test/Data/Yaml/IncludeSpec.hs → yaml/test/Data/Yaml/IncludeSpec.hsrenamed

The content is the same.

test/Data/Yaml/THSpec.hs → yaml/test/Data/Yaml/THSpec.hsrenamed

The content is the same.

test/Data/YamlSpec.hs → yaml/test/Data/YamlSpec.hsrenamed

The content is the same.

test/Spec.hs → yaml/test/Spec.hsrenamed

The content is the same.

test/json.yaml → yaml/test/json.yamlrenamed

The content is the same.

test/largest-string.yaml → yaml/test/largest-string.yamlrenamed

The content is the same.

test/resources/accent/foo.yaml → yaml/test/resources/accent/foo.yamlrenamed

The content is the same.

test/resources/bar.yaml → yaml/test/resources/bar.yamlrenamed

The content is the same.

test/resources/baz.yaml → yaml/test/resources/baz.yamlrenamed

The content is the same.

test/resources/empty.yaml → yaml/test/resources/empty.yamlrenamed

The content is the same.

test/resources/empty2.yaml → yaml/test/resources/empty2.yamlrenamed

The content is the same.

test/resources/foo.yaml → yaml/test/resources/foo.yamlrenamed

The content is the same.

test/resources/loop/bar.yaml → yaml/test/resources/loop/bar.yamlrenamed

The content is the same.

test/resources/loop/foo.yaml → yaml/test/resources/loop/foo.yamlrenamed

The content is the same.