Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another step in isolate yaml and prepare for HsYaml replacement #993

Merged
merged 38 commits into from
Jun 8, 2019

Conversation

jneira
Copy link
Collaborator

@jneira jneira commented Jun 7, 2019

Hi, this is a continuation of #989:

  • It makes json and yaml modules more symmetric (although not quite):
    • dhall ones includes some io logic and options/error handling extracted from the executables
  • It hides the fact we are converting from/to yaml using the json conversions. This likely will change if we finally use HsYaml (that has its own FromYaml type class)

However i somewhat dont like the signatures of main functions:

dhallFromYaml :: Options -> ByteString -> IO Text

dhallToYaml :: Options -> Text  -> Text -> IO ByteString

They are generic but not very safe (basically they are any -> any and throw exceptions).
When we will use HsYaml we could replace them or add another ones using FromYaml.

@jneira jneira requested a review from Gabriella439 June 7, 2019 08:41
@Gabriella439 Gabriella439 merged commit 5626427 into dhall-lang:master Jun 8, 2019
@Gabriella439
Copy link
Collaborator

@jneira: Thanks again! 🙂

@jneira jneira deleted the isolate-yaml2 branch June 8, 2019 06:27
Gabriella439 pushed a commit that referenced this pull request Jun 19, 2019
After #989 and #993 the use of the `yaml` package is isolated in the lib modules `Dhall.Yaml` and `Dhall.YamlToDhall` so it is easier to add support for compilers that cant use the `yaml`package like eta or ghcjs.

With this one we would add support for [eta](https://eta-lang.org/), a fork of ghc that compiles to jvm bytecode.

Main changes:

* Add conditional to cabal file and cpp conditions to the main modules for yaml to use a specific module for eta, `Dhall.Yaml.Eta` that replaces calls to the `yaml`package to ffi calls to the java lib [jackson](https://github.com/FasterXML/jackson), one of the most popular ones in the java world.
* Add the java files that contains the ffi calls
* Mark  `buildable: False` the subpackages that cant be built by eta for now

One effect of use the cabal file for cabal and etlas (the build tool for eta) is stack and cabal builds show those warnings:

```
Warning: Cabal file warning in D:\ws\eta\dhall\dhall-haskell\dhall-json\dhall-js
on.cabal@ 69:9:
         Unknown field: "maven-depends"

Warning: Cabal file warning in D:\ws\eta\dhall\dhall-haskell\dhall-json\dhall-js
on.cabal@ 74:9:
         Unknown field: "java-sources"
```

I've not found a way to avoid them other than use another file for etlas build (`etlas.dhall`). It would suppose duplicate most of the logic, though.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants