clovyr / aeson-yaml

Encode any Aeson (JSON) value as YAML (in pure Haskell)
https://hackage.haskell.org/package/aeson-yaml
BSD 3-Clause "New" or "Revised" License
12 stars 7 forks source link

Suggestion: Add comparison to other packages in package description #1

Closed sshine closed 5 years ago

sshine commented 5 years ago

It seems that this package generates raw YAML in the format of ByteStrings. One upside is that this package has very few dependencies.

The original intent of filing this issue was to recommend some interoperability with the yaml package, and an obvious downside here is that it gains more dependencies. But an upside is that you gain access to the most popular abstract representation of a YAML document (with 3635 Hackage downloads).

But now that I've glanced at the yaml package's internal representation, it actually uses aeson's! So the existing yaml package can, essentially, print a JSON document as YAML as a side-effect of having this internal representation. Its documentation does indeed say "As a result, much of the documentation below mentions JSON; do not let that confuse you, it's intentional."

The yaml package also mentions that "If you need to deal with YAML more directly (e.g., directly deal with aliases), you should use the Text.Libyaml module instead."

So I wonder, for the future of aeson-yaml, if it has a special use-case in also being able to deal with YAML more directly, and, as advertised in the package title, be without FFI? And if so, perhaps this feature should be highlighted to a greater extent as distinctive? Since otherwise, the existing, most popular yaml package already does convert JSON to YAML.

patrickmn commented 5 years ago

Hi,

I did attempt to state the motivation as the first line of the README:

BSD3-licensed library to encode any Aeson value as YAML, without a dependency on an external YAML library like yaml (libyaml C FFI) or HsYaml (GPL).

Perhaps you have an idea for better wording?

This library is specifically designed to avoid dependencies on libraries like yaml (due to the C bindings that, for example, don't work on GHCJS) and HsYaml (which is GPL-licensed).

If at some point a library is made available that does not have these constraints, we can revisit, but for now this library is doing what it's supposed to.

Hope that explains why this library doesn't rely on yaml.

sshine commented 5 years ago

Hi @patrickmn, and sorry for posting an issue prior to understanding the space of YAML packages.

That makes complete sense.

Since you're asking, how about:

BSD3-licensed library to encode any Aeson value as YAML, without a dependency on C FFI (as the package 'yaml') or a GPL license (as the package 'HsYAML'). As such, this library uses pure Haskell code under a less restrictive license and is compatible with GHCJS.

I assume that there are other necessities to make the package compatible with GHCJS, such as having it work with some slightly lower dependency bounds, which makes it worth mentioning.

Also, I am half Danish, but this is purely incidental. ;-)

patrickmn commented 5 years ago

Ah, funny! Hejsa :)

I added a Motivation section to the README that emphasizes the benefits, as you pointed out.

As it stands, the package should work with GHC/GHCJS >= 7.10.3, which seems like a reasonable floor.

Closing the issue. Thank you!

sshine commented 5 years ago

GHC/GHCJS >= 7.10.3, which seems like a reasonable floor

It certainly does. I just mention it because I probably wouldn't have picked it up from just "purely Haskell" -- having recently submitted my first PR for a Hackage package (that was also aeson-related) that just did version bumping, I realize that supporting pre-8.0 can be a minor hurdle.

If you intend to release any other packages into the wild, let me know if you need any contributors!

patrickmn commented 5 years ago

Ah, yup! Like <> not being exported by default :)

I set up https://github.com/clovyr/clovyr as something of a blog... if you watch its releases, I'll add ones when we push more libraries. There are several more small ones like aeson-yaml coming, and another few larger ones that are more interesting. Would love to have you contribute!

PS: I see you forked DikuMUD... I ran one of the top RoT-based MUDs (SDMUD) for 11 years! :)

Did we just become best friends?

sshine commented 5 years ago

Yes, forking it was an archaeology project; I tried to make it compile changing as little as possible. :)

DikuMUD was what got me into CS, so it's pure nostalgia.