Move HsYAML-based code to new package dhall-yaml (#1514)
* Shared code for the dhall-to-yaml[-ng] executables stays in dhall-json. * Shared tests are in dhall-yaml. Fixes #1435.
This commit is contained in:
parent
e931451a2b
commit
cd49b65c23
|
@ -47,13 +47,14 @@ install:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- export PATH="${PATH}:$(pwd)/bin"
|
- export PATH="${PATH}:$(pwd)/bin"
|
||||||
- stack build --flag dhall-json:gpl --copy-bins --local-bin-path ./bin
|
- stack build --copy-bins --local-bin-path ./bin
|
||||||
- source .travis-functions.sh
|
- source .travis-functions.sh
|
||||||
- tar -jcvf $(mk_release_name dhall) bin/dhall
|
- tar -jcvf $(mk_release_name dhall) bin/dhall
|
||||||
- tar -jcvf $(mk_release_name dhall-json) bin/dhall-to-json bin/dhall-to-yaml bin/json-to-dhall bin/yaml-to-dhall
|
- tar -jcvf $(mk_release_name dhall-json) bin/dhall-to-json bin/dhall-to-yaml bin/json-to-dhall
|
||||||
- tar -jcvf $(mk_release_name dhall-bash) bin/dhall-to-bash
|
- tar -jcvf $(mk_release_name dhall-bash) bin/dhall-to-bash
|
||||||
- tar -jcvf $(mk_release_name dhall-lsp-server) bin/dhall-lsp-server
|
- tar -jcvf $(mk_release_name dhall-lsp-server) bin/dhall-lsp-server
|
||||||
- tar -jcvf $(mk_release_name dhall-nix) bin/dhall-to-nix
|
- tar -jcvf $(mk_release_name dhall-nix) bin/dhall-to-nix
|
||||||
|
- tar -jcvf $(mk_release_name dhall-yaml) bin/dhall-to-yaml-ng bin/yaml-to-dhall
|
||||||
- mkdir -p uploads
|
- mkdir -p uploads
|
||||||
- mv *.tar.bz2 uploads/
|
- mv *.tar.bz2 uploads/
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ the following packages:
|
||||||
* [`dhall`](./dhall) - [![Hackage](https://img.shields.io/hackage/v/dhall.svg)](https://hackage.haskell.org/package/dhall)
|
* [`dhall`](./dhall) - [![Hackage](https://img.shields.io/hackage/v/dhall.svg)](https://hackage.haskell.org/package/dhall)
|
||||||
* [`dhall-bash`](./dhall-bash) - [![Hackage](https://img.shields.io/hackage/v/dhall-bash.svg)](https://hackage.haskell.org/package/dhall-bash)
|
* [`dhall-bash`](./dhall-bash) - [![Hackage](https://img.shields.io/hackage/v/dhall-bash.svg)](https://hackage.haskell.org/package/dhall-bash)
|
||||||
* [`dhall-json`](./dhall-json) - [![Hackage](https://img.shields.io/hackage/v/dhall-json.svg)](https://hackage.haskell.org/package/dhall-json)
|
* [`dhall-json`](./dhall-json) - [![Hackage](https://img.shields.io/hackage/v/dhall-json.svg)](https://hackage.haskell.org/package/dhall-json)
|
||||||
|
* [`dhall-yaml`](./dhall-yaml) - [![Hackage](https://img.shields.io/hackage/v/dhall-yaml.svg)](https://hackage.haskell.org/package/dhall-yaml)
|
||||||
* [`dhall-nix`](./dhall-nix) - [![Hackage](https://img.shields.io/hackage/v/dhall-nix.svg)](https://hackage.haskell.org/package/dhall-nix)
|
* [`dhall-nix`](./dhall-nix) - [![Hackage](https://img.shields.io/hackage/v/dhall-nix.svg)](https://hackage.haskell.org/package/dhall-nix)
|
||||||
|
|
||||||
Navigate to each package's directory for their respective `README`s
|
Navigate to each package's directory for their respective `README`s
|
||||||
|
@ -38,6 +39,7 @@ visit one of the following links:
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-bash/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-bash/latest)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-bash/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-bash/latest)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-json/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-json/latest)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-json/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-json/latest)
|
||||||
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-yaml/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-yaml/latest)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-nix/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-nix/latest)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-nix/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-nix/latest)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-lsp-server/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-lsp-server/latest)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-lsp-server/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-lsp-server/latest)
|
||||||
|
|
||||||
|
@ -67,6 +69,7 @@ download image archives for each package using the following URLs:
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall/latest/download/1/docker-image-dhall.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall/latest/download/1/docker-image-dhall.tar.gz)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall/latest/download/1/docker-image-dhall.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall/latest/download/1/docker-image-dhall.tar.gz)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-bash/latest/download/1/docker-image-dhall-bash.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-bash/latest/download/1/docker-image-dhall-bash.tar.gz)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-bash/latest/download/1/docker-image-dhall-bash.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-bash/latest/download/1/docker-image-dhall-bash.tar.gz)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-json/latest/download/1/docker-image-dhall-json.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-json/latest/download/1/docker-image-dhall-json.tar.gz)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-json/latest/download/1/docker-image-dhall-json.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-json/latest/download/1/docker-image-dhall-json.tar.gz)
|
||||||
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-yaml/latest/download/1/docker-image-dhall-yaml.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-yaml/latest/download/1/docker-image-dhall-yaml.tar.gz)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-lsp-server/latest/download/1/docker-image-dhall-lsp-server.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-lsp-server/latest/download/1/docker-image-dhall-lsp-server.tar.gz)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-lsp-server/latest/download/1/docker-image-dhall-lsp-server.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-lsp-server/latest/download/1/docker-image-dhall-lsp-server.tar.gz)
|
||||||
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-nix/latest/download/1/docker-image-dhall-nix.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-nix/latest/download/1/docker-image-dhall-nix.tar.gz)
|
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-nix/latest/download/1/docker-image-dhall-nix.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-nix/latest/download/1/docker-image-dhall-nix.tar.gz)
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,16 @@ for:
|
||||||
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-json.exe")
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-json.exe")
|
||||||
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-yaml.exe")
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-yaml.exe")
|
||||||
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\json-to-dhall.exe")
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\json-to-dhall.exe")
|
||||||
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\yaml-to-dhall.exe")
|
|
||||||
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-bash-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-bash.exe")
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-bash-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-bash.exe")
|
||||||
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-lsp-server-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-lsp-server.exe")
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-lsp-server-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-lsp-server.exe")
|
||||||
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-yaml-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-yaml-ng.exe")
|
||||||
|
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-yaml-%DEPLOY_TAG%" "%DEPLOY_DIR%\yaml-to-dhall.exe")
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
# chcp 65001 (utf-8) needed to make doctest work
|
# chcp 65001 (utf-8) needed to make doctest work
|
||||||
- chcp 65001 && stack test dhall
|
- chcp 65001 && stack test dhall
|
||||||
- stack test dhall-json
|
- stack test dhall-json
|
||||||
|
- stack test dhall-yaml
|
||||||
- stack test dhall-bash
|
- stack test dhall-bash
|
||||||
- stack test dhall-lsp-server
|
- stack test dhall-lsp-server
|
||||||
- stack bench dhall --benchmark-arguments "--quick --min-duration=0 --include-first-iter"
|
- stack bench dhall --benchmark-arguments "--quick --min-duration=0 --include-first-iter"
|
||||||
|
@ -79,6 +81,8 @@ artifacts:
|
||||||
name: dhall
|
name: dhall
|
||||||
- path: bin\dhall-json-%DEPLOY_TAG%
|
- path: bin\dhall-json-%DEPLOY_TAG%
|
||||||
name: dhall-json
|
name: dhall-json
|
||||||
|
- path: bin\dhall-yaml-%DEPLOY_TAG%
|
||||||
|
name: dhall-yaml
|
||||||
- path: bin\dhall-bash-%DEPLOY_TAG%
|
- path: bin\dhall-bash-%DEPLOY_TAG%
|
||||||
name: dhall-bash
|
name: dhall-bash
|
||||||
- path: bin\dhall-lsp-server-%DEPLOY_TAG%
|
- path: bin\dhall-lsp-server-%DEPLOY_TAG%
|
||||||
|
@ -88,7 +92,7 @@ deploy:
|
||||||
- provider: GitHub
|
- provider: GitHub
|
||||||
auth_token:
|
auth_token:
|
||||||
secure: Gs/tiz6Jtg/Zjd4zGHDhuSv4Y9a+zJ574LWwzOe2bvZNGX/M8XupkxdGmBpDlnOf
|
secure: Gs/tiz6Jtg/Zjd4zGHDhuSv4Y9a+zJ574LWwzOe2bvZNGX/M8XupkxdGmBpDlnOf
|
||||||
artifact: dhall, dhall-json, dhall-bash, dhall-lsp-server
|
artifact: dhall, dhall-json, dhall-yaml, dhall-bash, dhall-lsp-server
|
||||||
on:
|
on:
|
||||||
APPVEYOR_REPO_TAG: true
|
APPVEYOR_REPO_TAG: true
|
||||||
STACK_YAML: stack.yaml
|
STACK_YAML: stack.yaml
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
packages: ./dhall ./dhall-bash ./dhall-json ./dhall-lsp-server ./dhall-nix
|
packages: ./dhall ./dhall-bash ./dhall-json ./dhall-yaml ./dhall-lsp-server ./dhall-nix
|
||||||
|
|
|
@ -13,6 +13,7 @@ in
|
||||||
dhall-json
|
dhall-json
|
||||||
dhall-lsp-server
|
dhall-lsp-server
|
||||||
dhall-nix
|
dhall-nix
|
||||||
|
dhall-yaml
|
||||||
;
|
;
|
||||||
|
|
||||||
inherit (shared_ghcjs) dhall-try;
|
inherit (shared_ghcjs) dhall-try;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
The following license applies to this package when built without the
|
|
||||||
`-fgpl` Cabal configure flag
|
|
||||||
|
|
||||||
Copyright (c) 2018 Gabriel Gonzalez
|
Copyright (c) 2018 Gabriel Gonzalez
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
|
@ -10,10 +10,9 @@ Full documentation here:
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
This `dhall-json` package provides a Dhall to JSON compiler and a Dhall to YAML
|
This `dhall-json` package provides a Dhall to JSON compiler, and a Dhall to YAML
|
||||||
compiler. The reason this package is called `dhall-json` is that the Haskell
|
compiler based on that. The `dhall-to-yaml` executable is a "basic" version of
|
||||||
`yaml` library uses the same data structure as Haskell's `aeson` library for
|
the `dhall-to-yaml-ng` executable in the `dhall-yaml` package.
|
||||||
JSON
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
@ -30,3 +29,9 @@ foo:
|
||||||
bar:
|
bar:
|
||||||
baz: true
|
baz: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
This package's `dhall-to-yaml` and `dhall-yaml`'s `dhall-to-yaml-ng` should be
|
||||||
|
kept as closely in sync as possible. Common code for these executables lives
|
||||||
|
in this package, tests live in `dhall-yaml`.
|
||||||
|
|
|
@ -4,7 +4,7 @@ Cabal-Version: >=1.8.0.2
|
||||||
Build-Type: Simple
|
Build-Type: Simple
|
||||||
Tested-With: GHC == 7.10.3, GHC == 8.4.3, GHC == 8.6.1
|
Tested-With: GHC == 7.10.3, GHC == 8.4.3, GHC == 8.6.1
|
||||||
License: BSD3
|
License: BSD3
|
||||||
License-Files: LICENSE.BSD3, LICENSE.GPLv3
|
License-File: LICENSE
|
||||||
Copyright: 2017 Gabriel Gonzalez
|
Copyright: 2017 Gabriel Gonzalez
|
||||||
Author: Gabriel Gonzalez
|
Author: Gabriel Gonzalez
|
||||||
Maintainer: Gabriel439@gmail.com
|
Maintainer: Gabriel439@gmail.com
|
||||||
|
@ -26,24 +26,18 @@ Extra-Source-Files:
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
tasty/data/*.dhall
|
tasty/data/*.dhall
|
||||||
tasty/data/*.json
|
tasty/data/*.json
|
||||||
tasty/data/*.txt
|
|
||||||
tasty/data/*.yaml
|
|
||||||
|
|
||||||
Source-Repository head
|
Source-Repository head
|
||||||
Type: git
|
Type: git
|
||||||
Location: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json
|
Location: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json
|
||||||
|
|
||||||
Flag gpl
|
|
||||||
Description: Use GPL-licensed components like HsYAML, and enable yaml-to-dhall binary
|
|
||||||
Default: False
|
|
||||||
Manual: True
|
|
||||||
|
|
||||||
Library
|
Library
|
||||||
Hs-Source-Dirs: src
|
Hs-Source-Dirs: src
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
base >= 4.8.0.0 && < 5 ,
|
base >= 4.8.0.0 && < 5 ,
|
||||||
aeson >= 1.0.0.0 && < 1.5 ,
|
aeson >= 1.0.0.0 && < 1.5 ,
|
||||||
aeson-pretty < 0.9 ,
|
aeson-pretty < 0.9 ,
|
||||||
|
aeson-yaml >= 1.0.4 && < 1.1 ,
|
||||||
bytestring < 0.11,
|
bytestring < 0.11,
|
||||||
containers ,
|
containers ,
|
||||||
dhall >= 1.27.0 && < 1.28,
|
dhall >= 1.27.0 && < 1.28,
|
||||||
|
@ -58,21 +52,11 @@ Library
|
||||||
Exposed-Modules:
|
Exposed-Modules:
|
||||||
Dhall.JSON
|
Dhall.JSON
|
||||||
Dhall.JSONToDhall
|
Dhall.JSONToDhall
|
||||||
Dhall.Yaml
|
Dhall.JSON.Yaml
|
||||||
if flag(gpl)
|
Dhall.DhallToYaml.Main
|
||||||
Exposed-Modules:
|
|
||||||
Dhall.YamlToDhall
|
|
||||||
Other-Modules:
|
Other-Modules:
|
||||||
Dhall.JSON.Util
|
Dhall.JSON.Util
|
||||||
GHC-Options: -Wall
|
GHC-Options: -Wall
|
||||||
if flag(gpl)
|
|
||||||
CPP-Options: -DGPL
|
|
||||||
Build-Depends:
|
|
||||||
HsYAML >= 0.2 && < 0.3,
|
|
||||||
HsYAML-aeson >= 0.2 && < 0.3
|
|
||||||
else
|
|
||||||
Build-Depends:
|
|
||||||
aeson-yaml >= 1.0.2 && < 1.1
|
|
||||||
|
|
||||||
Executable dhall-to-json
|
Executable dhall-to-json
|
||||||
Hs-Source-Dirs: dhall-to-json
|
Hs-Source-Dirs: dhall-to-json
|
||||||
|
@ -94,13 +78,8 @@ Executable dhall-to-yaml
|
||||||
Hs-Source-Dirs: dhall-to-yaml
|
Hs-Source-Dirs: dhall-to-yaml
|
||||||
Main-Is: Main.hs
|
Main-Is: Main.hs
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
base ,
|
base ,
|
||||||
aeson ,
|
dhall-json
|
||||||
bytestring < 0.11,
|
|
||||||
dhall ,
|
|
||||||
dhall-json ,
|
|
||||||
optparse-applicative ,
|
|
||||||
text
|
|
||||||
Other-Modules:
|
Other-Modules:
|
||||||
Paths_dhall_json
|
Paths_dhall_json
|
||||||
GHC-Options: -Wall
|
GHC-Options: -Wall
|
||||||
|
@ -126,35 +105,12 @@ Executable json-to-dhall
|
||||||
Paths_dhall_json
|
Paths_dhall_json
|
||||||
GHC-Options: -Wall
|
GHC-Options: -Wall
|
||||||
|
|
||||||
Executable yaml-to-dhall
|
|
||||||
if !flag(gpl)
|
|
||||||
Buildable: False
|
|
||||||
Hs-Source-Dirs: yaml-to-dhall
|
|
||||||
Main-Is: Main.hs
|
|
||||||
Build-Depends:
|
|
||||||
base ,
|
|
||||||
aeson ,
|
|
||||||
ansi-terminal >= 0.6.3.1 && < 0.11,
|
|
||||||
bytestring < 0.11,
|
|
||||||
dhall ,
|
|
||||||
dhall-json ,
|
|
||||||
exceptions >= 0.8.3 && < 0.11,
|
|
||||||
optparse-applicative ,
|
|
||||||
prettyprinter ,
|
|
||||||
prettyprinter-ansi-terminal >= 1.1.1 && < 1.2 ,
|
|
||||||
text < 1.3
|
|
||||||
if !impl(ghc >= 8.0) && !impl(eta >= 0.8.4)
|
|
||||||
Build-Depends: semigroups == 0.18.*
|
|
||||||
Other-Modules:
|
|
||||||
Paths_dhall_json
|
|
||||||
GHC-Options: -Wall
|
|
||||||
|
|
||||||
Test-Suite tasty
|
Test-Suite tasty
|
||||||
Type: exitcode-stdio-1.0
|
Type: exitcode-stdio-1.0
|
||||||
Hs-Source-Dirs: tasty
|
Hs-Source-Dirs: tasty
|
||||||
Main-Is: Main.hs
|
Main-Is: Main.hs
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
base,
|
base ,
|
||||||
aeson ,
|
aeson ,
|
||||||
bytestring ,
|
bytestring ,
|
||||||
dhall ,
|
dhall ,
|
||||||
|
@ -162,3 +118,4 @@ Test-Suite tasty
|
||||||
tasty < 1.3,
|
tasty < 1.3,
|
||||||
text ,
|
text ,
|
||||||
tasty-hunit >= 0.2
|
tasty-hunit >= 0.2
|
||||||
|
GHC-Options: -Wall
|
||||||
|
|
|
@ -1,101 +1,8 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Control.Applicative (optional, (<|>))
|
import qualified Dhall.DhallToYaml.Main
|
||||||
import Control.Exception (SomeException)
|
import qualified Dhall.JSON.Yaml
|
||||||
import Data.Monoid ((<>))
|
import qualified Paths_dhall_json as Meta
|
||||||
import Dhall.JSON (parsePreservationAndOmission, parseConversion)
|
|
||||||
import Dhall.Yaml (Options(..), dhallToYaml, parseDocuments, parseQuoted)
|
|
||||||
import Options.Applicative (Parser, ParserInfo)
|
|
||||||
|
|
||||||
import qualified Control.Exception
|
|
||||||
import qualified Data.ByteString
|
|
||||||
import qualified Data.Text.IO as Text.IO
|
|
||||||
import qualified Data.Version
|
|
||||||
import qualified GHC.IO.Encoding
|
|
||||||
import qualified Options.Applicative as Options
|
|
||||||
import qualified Paths_dhall_json as Meta
|
|
||||||
import qualified System.Exit
|
|
||||||
import qualified System.IO
|
|
||||||
|
|
||||||
parseOptions :: Parser (Maybe Options)
|
|
||||||
parseOptions =
|
|
||||||
Just
|
|
||||||
<$> ( Options
|
|
||||||
<$> parseExplain
|
|
||||||
<*> Dhall.JSON.parsePreservationAndOmission
|
|
||||||
<*> parseDocuments
|
|
||||||
<*> parseQuoted
|
|
||||||
<*> Dhall.JSON.parseConversion
|
|
||||||
<*> optional parseFile
|
|
||||||
<*> optional parseOutput
|
|
||||||
)
|
|
||||||
<|> parseVersion
|
|
||||||
where
|
|
||||||
parseExplain =
|
|
||||||
Options.switch
|
|
||||||
( Options.long "explain"
|
|
||||||
<> Options.help "Explain error messages in detail"
|
|
||||||
)
|
|
||||||
|
|
||||||
parseFile =
|
|
||||||
Options.strOption
|
|
||||||
( Options.long "file"
|
|
||||||
<> Options.help "Read expression from a file instead of standard input"
|
|
||||||
<> Options.metavar "FILE"
|
|
||||||
)
|
|
||||||
|
|
||||||
parseVersion =
|
|
||||||
Options.flag'
|
|
||||||
Nothing
|
|
||||||
( Options.long "version"
|
|
||||||
<> Options.help "Display version"
|
|
||||||
)
|
|
||||||
|
|
||||||
parseOutput =
|
|
||||||
Options.strOption
|
|
||||||
( Options.long "output"
|
|
||||||
<> Options.help "Write YAML to a file instead of standard output"
|
|
||||||
<> Options.metavar "FILE"
|
|
||||||
)
|
|
||||||
|
|
||||||
parserInfo :: ParserInfo (Maybe Options)
|
|
||||||
parserInfo =
|
|
||||||
Options.info
|
|
||||||
(Options.helper <*> parseOptions)
|
|
||||||
( Options.fullDesc
|
|
||||||
<> Options.progDesc "Compile Dhall to YAML"
|
|
||||||
)
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = Dhall.DhallToYaml.Main.main Meta.version Dhall.JSON.Yaml.dhallToYaml
|
||||||
GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8
|
|
||||||
|
|
||||||
maybeOptions <- Options.execParser parserInfo
|
|
||||||
|
|
||||||
case maybeOptions of
|
|
||||||
Nothing -> do
|
|
||||||
putStrLn (Data.Version.showVersion Meta.version)
|
|
||||||
|
|
||||||
Just options@(Options {..}) -> do
|
|
||||||
handle $ do
|
|
||||||
contents <- case file of
|
|
||||||
Nothing -> Text.IO.getContents
|
|
||||||
Just path -> Text.IO.readFile path
|
|
||||||
|
|
||||||
let write =
|
|
||||||
case output of
|
|
||||||
Nothing -> Data.ByteString.putStr
|
|
||||||
Just file_ -> Data.ByteString.writeFile file_
|
|
||||||
|
|
||||||
write =<< dhallToYaml options file contents
|
|
||||||
|
|
||||||
handle :: IO a -> IO a
|
|
||||||
handle = Control.Exception.handle handler
|
|
||||||
where
|
|
||||||
handler :: SomeException -> IO a
|
|
||||||
handler e = do
|
|
||||||
System.IO.hPutStrLn System.IO.stderr ""
|
|
||||||
System.IO.hPrint System.IO.stderr e
|
|
||||||
System.Exit.exitFailure
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
let
|
|
||||||
default = (import ./default.nix);
|
|
||||||
|
|
||||||
in
|
|
||||||
{ dhall-json = default.all;
|
|
||||||
|
|
||||||
inherit (default) tarball;
|
|
||||||
}
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
|
|
||||||
|
{- Shared code for the @dhall-to-yaml@ and @dhall-to-yaml-ng@ executables
|
||||||
|
-}
|
||||||
|
module Dhall.DhallToYaml.Main (main) where
|
||||||
|
|
||||||
|
import Control.Applicative (optional, (<|>))
|
||||||
|
import Control.Exception (SomeException)
|
||||||
|
import Data.ByteString (ByteString)
|
||||||
|
import Data.Monoid ((<>))
|
||||||
|
import Data.Text (Text)
|
||||||
|
import Dhall.JSON (parsePreservationAndOmission, parseConversion)
|
||||||
|
import Dhall.JSON.Yaml (Options(..), parseDocuments, parseQuoted)
|
||||||
|
import Options.Applicative (Parser, ParserInfo)
|
||||||
|
|
||||||
|
import qualified Control.Exception
|
||||||
|
import qualified Data.ByteString
|
||||||
|
import qualified Data.Text.IO as Text.IO
|
||||||
|
import qualified Data.Version
|
||||||
|
import qualified GHC.IO.Encoding
|
||||||
|
import qualified Options.Applicative as Options
|
||||||
|
import qualified System.Exit
|
||||||
|
import qualified System.IO
|
||||||
|
|
||||||
|
parseOptions :: Parser (Maybe Options)
|
||||||
|
parseOptions =
|
||||||
|
Just
|
||||||
|
<$> ( Options
|
||||||
|
<$> parseExplain
|
||||||
|
<*> Dhall.JSON.parsePreservationAndOmission
|
||||||
|
<*> parseDocuments
|
||||||
|
<*> parseQuoted
|
||||||
|
<*> Dhall.JSON.parseConversion
|
||||||
|
<*> optional parseFile
|
||||||
|
<*> optional parseOutput
|
||||||
|
)
|
||||||
|
<|> parseVersion
|
||||||
|
where
|
||||||
|
parseExplain =
|
||||||
|
Options.switch
|
||||||
|
( Options.long "explain"
|
||||||
|
<> Options.help "Explain error messages in detail"
|
||||||
|
)
|
||||||
|
|
||||||
|
parseFile =
|
||||||
|
Options.strOption
|
||||||
|
( Options.long "file"
|
||||||
|
<> Options.help "Read expression from a file instead of standard input"
|
||||||
|
<> Options.metavar "FILE"
|
||||||
|
)
|
||||||
|
|
||||||
|
parseVersion =
|
||||||
|
Options.flag'
|
||||||
|
Nothing
|
||||||
|
( Options.long "version"
|
||||||
|
<> Options.help "Display version"
|
||||||
|
)
|
||||||
|
|
||||||
|
parseOutput =
|
||||||
|
Options.strOption
|
||||||
|
( Options.long "output"
|
||||||
|
<> Options.help "Write YAML to a file instead of standard output"
|
||||||
|
<> Options.metavar "FILE"
|
||||||
|
)
|
||||||
|
|
||||||
|
parserInfo :: ParserInfo (Maybe Options)
|
||||||
|
parserInfo =
|
||||||
|
Options.info
|
||||||
|
(Options.helper <*> parseOptions)
|
||||||
|
( Options.fullDesc
|
||||||
|
<> Options.progDesc "Compile Dhall to YAML"
|
||||||
|
)
|
||||||
|
|
||||||
|
main
|
||||||
|
:: Data.Version.Version
|
||||||
|
-> (Options -> Maybe FilePath -> Text -> IO ByteString)
|
||||||
|
-> IO ()
|
||||||
|
main version dhallToYaml = do
|
||||||
|
GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8
|
||||||
|
|
||||||
|
maybeOptions <- Options.execParser parserInfo
|
||||||
|
|
||||||
|
case maybeOptions of
|
||||||
|
Nothing -> do
|
||||||
|
putStrLn (Data.Version.showVersion version)
|
||||||
|
|
||||||
|
Just options@(Options {..}) -> do
|
||||||
|
handle $ do
|
||||||
|
contents <- case file of
|
||||||
|
Nothing -> Text.IO.getContents
|
||||||
|
Just path -> Text.IO.readFile path
|
||||||
|
|
||||||
|
let write =
|
||||||
|
case output of
|
||||||
|
Nothing -> Data.ByteString.putStr
|
||||||
|
Just file_ -> Data.ByteString.writeFile file_
|
||||||
|
|
||||||
|
write =<< dhallToYaml options file contents
|
||||||
|
|
||||||
|
handle :: IO a -> IO a
|
||||||
|
handle = Control.Exception.handle handler
|
||||||
|
where
|
||||||
|
handler :: SomeException -> IO a
|
||||||
|
handler e = do
|
||||||
|
System.IO.hPutStrLn System.IO.stderr ""
|
||||||
|
System.IO.hPrint System.IO.stderr e
|
||||||
|
System.Exit.exitFailure
|
|
@ -2,7 +2,12 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
|
|
||||||
module Dhall.Yaml
|
{-| Convert Dhall to YAML via JSON
|
||||||
|
|
||||||
|
Since JSON is only a subset of YAML, the functionality offered here is more
|
||||||
|
limited than what the @dhall-yaml@ package can offer.
|
||||||
|
-}
|
||||||
|
module Dhall.JSON.Yaml
|
||||||
( Options(..)
|
( Options(..)
|
||||||
, parseDocuments
|
, parseDocuments
|
||||||
, parseQuoted
|
, parseQuoted
|
||||||
|
@ -16,24 +21,13 @@ import Data.Monoid ((<>))
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Dhall.JSON (Conversion(..), SpecialDoubleMode(..), codeToValue)
|
import Dhall.JSON (Conversion(..), SpecialDoubleMode(..), codeToValue)
|
||||||
import Options.Applicative (Parser)
|
import Options.Applicative (Parser)
|
||||||
import Data.ByteString.Lazy (toStrict)
|
|
||||||
|
|
||||||
import qualified Data.Aeson
|
import qualified Data.Aeson
|
||||||
import qualified Data.ByteString
|
import qualified Data.Aeson.Yaml
|
||||||
|
import qualified Data.ByteString.Lazy
|
||||||
import qualified Data.Vector
|
import qualified Data.Vector
|
||||||
import qualified Dhall
|
import qualified Dhall
|
||||||
import qualified Options.Applicative
|
import qualified Options.Applicative
|
||||||
#if defined(GPL)
|
|
||||||
import qualified Data.YAML.Aeson
|
|
||||||
import qualified Data.YAML as Y
|
|
||||||
import qualified Data.YAML.Event as YE
|
|
||||||
import qualified Data.YAML.Token as YT
|
|
||||||
import qualified Data.YAML.Schema as YS
|
|
||||||
import qualified Data.Text as Text
|
|
||||||
#else
|
|
||||||
import qualified Data.Aeson.Yaml
|
|
||||||
import qualified Data.ByteString.Lazy
|
|
||||||
#endif
|
|
||||||
|
|
||||||
data Options = Options
|
data Options = Options
|
||||||
{ explain :: Bool
|
{ explain :: Bool
|
||||||
|
@ -93,24 +87,6 @@ jsonToYaml
|
||||||
-> Bool
|
-> Bool
|
||||||
-> ByteString
|
-> ByteString
|
||||||
jsonToYaml json documents quoted =
|
jsonToYaml json documents quoted =
|
||||||
#if defined(GPL)
|
|
||||||
case (documents, json) of
|
|
||||||
(True, Data.Aeson.Array elems)
|
|
||||||
-> Data.ByteString.intercalate "\n---\n"
|
|
||||||
$ fmap (Data.ByteString.Lazy.toStrict. (Data.YAML.Aeson.encodeValue' schemaEncoder YT.UTF8). (:[]))
|
|
||||||
$ Data.Vector.toList elems
|
|
||||||
_ -> Data.ByteString.Lazy.toStrict (Data.YAML.Aeson.encodeValue' schemaEncoder YT.UTF8 [json])
|
|
||||||
where
|
|
||||||
style (Y.SStr s)
|
|
||||||
| "\n" `Text.isInfixOf` s =
|
|
||||||
Right (YE.untagged, YE.Literal YE.Clip YE.IndentAuto, s)
|
|
||||||
| quoted =
|
|
||||||
Right (YE.untagged, YE.SingleQuoted, s)
|
|
||||||
style s =
|
|
||||||
YS.schemaEncoderScalar Y.coreSchemaEncoder s
|
|
||||||
|
|
||||||
schemaEncoder = YS.setScalarStyle style Y.coreSchemaEncoder
|
|
||||||
#else
|
|
||||||
Data.ByteString.Lazy.toStrict $ case (documents, json) of
|
Data.ByteString.Lazy.toStrict $ case (documents, json) of
|
||||||
(True, Data.Aeson.Array elems)
|
(True, Data.Aeson.Array elems)
|
||||||
-> (if quoted
|
-> (if quoted
|
||||||
|
@ -121,4 +97,3 @@ jsonToYaml json documents quoted =
|
||||||
then Data.Aeson.Yaml.encodeQuoted
|
then Data.Aeson.Yaml.encodeQuoted
|
||||||
else Data.Aeson.Yaml.encode
|
else Data.Aeson.Yaml.encode
|
||||||
) json
|
) json
|
||||||
#endif
|
|
|
@ -9,7 +9,6 @@ import Dhall.JSON (Conversion(..))
|
||||||
import Test.Tasty (TestTree)
|
import Test.Tasty (TestTree)
|
||||||
|
|
||||||
import qualified Data.Aeson as Aeson
|
import qualified Data.Aeson as Aeson
|
||||||
import qualified Data.ByteString
|
|
||||||
import qualified Data.ByteString.Lazy
|
import qualified Data.ByteString.Lazy
|
||||||
import qualified Data.Text.IO
|
import qualified Data.Text.IO
|
||||||
import qualified Dhall.Core as Core
|
import qualified Dhall.Core as Core
|
||||||
|
@ -18,7 +17,6 @@ import qualified Dhall.JSON
|
||||||
import qualified Dhall.JSONToDhall as JSONToDhall
|
import qualified Dhall.JSONToDhall as JSONToDhall
|
||||||
import qualified Dhall.Parser
|
import qualified Dhall.Parser
|
||||||
import qualified Dhall.TypeCheck
|
import qualified Dhall.TypeCheck
|
||||||
import qualified Dhall.Yaml
|
|
||||||
import qualified GHC.IO.Encoding
|
import qualified GHC.IO.Encoding
|
||||||
import qualified Test.Tasty
|
import qualified Test.Tasty
|
||||||
import qualified Test.Tasty.HUnit
|
import qualified Test.Tasty.HUnit
|
||||||
|
@ -33,15 +31,6 @@ testTree :: TestTree
|
||||||
testTree =
|
testTree =
|
||||||
Test.Tasty.testGroup "dhall-json"
|
Test.Tasty.testGroup "dhall-json"
|
||||||
[ testDhallToJSON "./tasty/data/issue48"
|
[ testDhallToJSON "./tasty/data/issue48"
|
||||||
, testDhallToYaml
|
|
||||||
Dhall.Yaml.defaultOptions
|
|
||||||
"./tasty/data/normal"
|
|
||||||
, testDhallToYaml
|
|
||||||
Dhall.Yaml.defaultOptions
|
|
||||||
"./tasty/data/special"
|
|
||||||
, testDhallToYaml
|
|
||||||
(Dhall.Yaml.defaultOptions { Dhall.Yaml.quoted = True })
|
|
||||||
"./tasty/data/quoted"
|
|
||||||
, testJSONToDhall "./tasty/data/emptyAlternative"
|
, testJSONToDhall "./tasty/data/emptyAlternative"
|
||||||
, testJSONToDhall "./tasty/data/emptyObject"
|
, testJSONToDhall "./tasty/data/emptyObject"
|
||||||
, testJSONToDhall "./tasty/data/emptyList"
|
, testJSONToDhall "./tasty/data/emptyList"
|
||||||
|
@ -140,19 +129,3 @@ testCustomConversionJSONToDhall conv prefix =
|
||||||
|
|
||||||
testJSONToDhall :: String -> TestTree
|
testJSONToDhall :: String -> TestTree
|
||||||
testJSONToDhall = testCustomConversionJSONToDhall JSONToDhall.defaultConversion
|
testJSONToDhall = testCustomConversionJSONToDhall JSONToDhall.defaultConversion
|
||||||
|
|
||||||
testDhallToYaml :: Dhall.Yaml.Options -> String -> TestTree
|
|
||||||
testDhallToYaml options prefix = Test.Tasty.HUnit.testCase prefix $ do
|
|
||||||
let inputFile = prefix <> ".dhall"
|
|
||||||
let outputFile = prefix <> ".yaml"
|
|
||||||
|
|
||||||
text <- Data.Text.IO.readFile inputFile
|
|
||||||
|
|
||||||
actualValue <- do
|
|
||||||
Dhall.Yaml.dhallToYaml options (Just inputFile) text
|
|
||||||
|
|
||||||
expectedValue <- Data.ByteString.readFile outputFile
|
|
||||||
|
|
||||||
let message = "Conversion to YAML did not generate the expected output"
|
|
||||||
|
|
||||||
Test.Tasty.HUnit.assertEqual message expectedValue actualValue
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
|
||||||
import qualified Dhall.Core
|
import qualified Dhall.Core
|
||||||
import qualified Dhall.Import
|
import qualified Dhall.Import
|
||||||
import qualified Dhall.JSON
|
import qualified Dhall.JSON
|
||||||
import qualified Dhall.Yaml
|
import qualified Dhall.JSON.Yaml
|
||||||
import qualified Dhall.Parser
|
import qualified Dhall.Parser
|
||||||
import qualified Dhall.Pretty
|
import qualified Dhall.Pretty
|
||||||
import qualified Dhall.TypeCheck
|
import qualified Dhall.TypeCheck
|
||||||
|
@ -133,7 +133,7 @@ main = do
|
||||||
Left exception -> do
|
Left exception -> do
|
||||||
errOutput exception
|
errOutput exception
|
||||||
Right value -> do
|
Right value -> do
|
||||||
let yamlBytes = Dhall.Yaml.jsonToYaml value False False
|
let yamlBytes = Dhall.JSON.Yaml.jsonToYaml value False False
|
||||||
case Data.Text.Encoding.decodeUtf8' yamlBytes of
|
case Data.Text.Encoding.decodeUtf8' yamlBytes of
|
||||||
Left exception -> do
|
Left exception -> do
|
||||||
errOutput exception
|
errOutput exception
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
The following license applies to this package when built with the
|
|
||||||
`-fgpl` Cabal configure flag, including the `yaml-to-dhall` executable,
|
|
||||||
which cannot be built without that flag.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
# `dhall-yaml`
|
||||||
|
|
||||||
|
For installation or development instructions, see:
|
||||||
|
|
||||||
|
* [`dhall-haskell` - `README`](https://github.com/dhall-lang/dhall-haskell/blob/master/README.md)
|
||||||
|
|
||||||
|
Full documentation here:
|
||||||
|
|
||||||
|
* [`dhall-yaml` instructions](https://hackage.haskell.org/package/dhall-yaml/docs/Dhall-Yaml.html)
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This `dhall-yaml` package provides a Dhall to YAML compiler, `dhall-to-yaml-ng`,
|
||||||
|
and a tool for deriving Dhall from YAML code: `yaml-to-dhall`.
|
||||||
|
|
||||||
|
Tutorials for the analogous JSON tools are available in the `dhall-json` package:
|
||||||
|
|
||||||
|
* [`dhall-to-json`](https://hackage.haskell.org/package/dhall-json/docs/Dhall-JSON.html)
|
||||||
|
|
||||||
|
* [`json-to-dhall`](https://hackage.haskell.org/package/dhall-json/docs/Dhall-JSONToDhall.html)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dhall-to-yaml-ng <<< "{ foo = [1, 2, 3], bar = { baz = True } }" > example.yaml
|
||||||
|
$ cat example.yaml
|
||||||
|
bar:
|
||||||
|
baz: true
|
||||||
|
foo:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- 3
|
||||||
|
$ yaml-to-dhall '{ foo : List Natural, bar : { baz : Bool } }' < example.yaml
|
||||||
|
{ bar = { baz = True }, foo = [ 1, 2, 3 ] }
|
||||||
|
```
|
|
@ -0,0 +1 @@
|
||||||
|
(import ../nix/shared.nix {}).possibly-static.dhall-yaml
|
|
@ -0,0 +1,8 @@
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import qualified Dhall.DhallToYaml.Main
|
||||||
|
import qualified Dhall.Yaml
|
||||||
|
import qualified Paths_dhall_yaml as Meta
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = Dhall.DhallToYaml.Main.main Meta.version Dhall.Yaml.dhallToYaml
|
|
@ -0,0 +1,97 @@
|
||||||
|
Name: dhall-yaml
|
||||||
|
Version: 1.6.0
|
||||||
|
Cabal-Version: >=1.8.0.2
|
||||||
|
Build-Type: Simple
|
||||||
|
Tested-With: GHC == 7.10.3, GHC == 8.4.3, GHC == 8.6.1
|
||||||
|
License: GPL-3
|
||||||
|
License-File: LICENSE
|
||||||
|
Copyright: 2019 Gabriel Gonzalez
|
||||||
|
Author: Gabriel Gonzalez
|
||||||
|
Maintainer: Gabriel439@gmail.com
|
||||||
|
Bug-Reports: https://github.com/dhall-lang/dhall-haskell/issues
|
||||||
|
Synopsis: Convert between Dhall and YAML
|
||||||
|
Description:
|
||||||
|
Use this package if you want to convert between Dhall expressions and YAML.
|
||||||
|
You can use this package as a library or an executable:
|
||||||
|
.
|
||||||
|
* See the "Dhall.Yaml" module if you want to use this package as a library
|
||||||
|
.
|
||||||
|
* Use the @dhall-to-yaml-ng@ program from this package if you want an executable
|
||||||
|
Category: Compiler
|
||||||
|
Extra-Source-Files:
|
||||||
|
CHANGELOG.md
|
||||||
|
README.md
|
||||||
|
tasty/data/*.dhall
|
||||||
|
tasty/data/*.yaml
|
||||||
|
tasty/data/*.txt
|
||||||
|
|
||||||
|
Source-Repository head
|
||||||
|
Type: git
|
||||||
|
Location: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml
|
||||||
|
|
||||||
|
Library
|
||||||
|
Hs-Source-Dirs: src
|
||||||
|
Build-Depends:
|
||||||
|
HsYAML >= 0.2 && < 0.3 ,
|
||||||
|
HsYAML-aeson >= 0.2 && < 0.3 ,
|
||||||
|
base >= 4.8.0.0 && < 5 ,
|
||||||
|
aeson >= 1.0.0.0 && < 1.5 ,
|
||||||
|
bytestring < 0.11,
|
||||||
|
dhall >= 1.27.0 && < 1.28,
|
||||||
|
dhall-json >= 1.5.0 && < 1.6 ,
|
||||||
|
optparse-applicative >= 0.14.0.0 && < 0.16,
|
||||||
|
text >= 0.11.1.0 && < 1.3 ,
|
||||||
|
vector
|
||||||
|
Exposed-Modules:
|
||||||
|
Dhall.Yaml
|
||||||
|
Dhall.YamlToDhall
|
||||||
|
GHC-Options: -Wall
|
||||||
|
|
||||||
|
Executable dhall-to-yaml-ng
|
||||||
|
Hs-Source-Dirs: dhall-to-yaml-ng
|
||||||
|
Main-Is: Main.hs
|
||||||
|
Build-Depends:
|
||||||
|
base ,
|
||||||
|
dhall-json,
|
||||||
|
dhall-yaml
|
||||||
|
Other-Modules:
|
||||||
|
Paths_dhall_yaml
|
||||||
|
GHC-Options: -Wall
|
||||||
|
|
||||||
|
Executable yaml-to-dhall
|
||||||
|
Hs-Source-Dirs: yaml-to-dhall
|
||||||
|
Main-Is: Main.hs
|
||||||
|
Build-Depends:
|
||||||
|
base ,
|
||||||
|
aeson ,
|
||||||
|
ansi-terminal >= 0.6.3.1 && < 0.11,
|
||||||
|
bytestring < 0.11,
|
||||||
|
dhall ,
|
||||||
|
dhall-json ,
|
||||||
|
dhall-yaml ,
|
||||||
|
exceptions >= 0.8.3 && < 0.11,
|
||||||
|
optparse-applicative ,
|
||||||
|
prettyprinter ,
|
||||||
|
prettyprinter-ansi-terminal >= 1.1.1 && < 1.2 ,
|
||||||
|
text < 1.3
|
||||||
|
if !impl(ghc >= 8.0) && !impl(eta >= 0.8.4)
|
||||||
|
Build-Depends: semigroups == 0.18.*
|
||||||
|
Other-Modules:
|
||||||
|
Paths_dhall_yaml
|
||||||
|
GHC-Options: -Wall
|
||||||
|
|
||||||
|
Test-Suite tasty
|
||||||
|
Type: exitcode-stdio-1.0
|
||||||
|
Hs-Source-Dirs: tasty
|
||||||
|
Main-Is: Main.hs
|
||||||
|
Build-Depends:
|
||||||
|
base ,
|
||||||
|
bytestring ,
|
||||||
|
dhall ,
|
||||||
|
dhall-json ,
|
||||||
|
dhall-yaml ,
|
||||||
|
tasty < 1.3,
|
||||||
|
tasty-expected-failure < 0.12,
|
||||||
|
text ,
|
||||||
|
tasty-hunit >= 0.2
|
||||||
|
GHC-Options: -Wall
|
|
@ -0,0 +1 @@
|
||||||
|
(import ../nix/shared.nix {}).shell-dhall-yaml
|
|
@ -0,0 +1,68 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
|
{-| Convert Dhall to YAML
|
||||||
|
|
||||||
|
-}
|
||||||
|
module Dhall.Yaml
|
||||||
|
( Options(..)
|
||||||
|
, Dhall.JSON.Yaml.defaultOptions
|
||||||
|
, dhallToYaml
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Data.ByteString (ByteString)
|
||||||
|
import Data.Text (Text)
|
||||||
|
import Dhall.JSON (SpecialDoubleMode(..), codeToValue)
|
||||||
|
import Dhall.JSON.Yaml (Options(..))
|
||||||
|
import Data.ByteString.Lazy (toStrict)
|
||||||
|
|
||||||
|
import qualified Data.Aeson
|
||||||
|
import qualified Data.ByteString
|
||||||
|
import qualified Data.Text as Text
|
||||||
|
import qualified Data.Vector
|
||||||
|
import qualified Data.YAML as Y
|
||||||
|
import qualified Data.YAML.Aeson
|
||||||
|
import qualified Data.YAML.Event as YE
|
||||||
|
import qualified Data.YAML.Schema as YS
|
||||||
|
import qualified Data.YAML.Token as YT
|
||||||
|
import qualified Dhall
|
||||||
|
import qualified Dhall.JSON.Yaml
|
||||||
|
|
||||||
|
{-| Convert a piece of 'Text' carrying a Dhall inscription to an equivalent @YAML@ 'ByteString'
|
||||||
|
-}
|
||||||
|
dhallToYaml
|
||||||
|
:: Options
|
||||||
|
-> Maybe FilePath -- ^ The source file path. If no path is given, imports
|
||||||
|
-- are resolved relative to the current directory.
|
||||||
|
-> Text -- ^ Input text.
|
||||||
|
-> IO ByteString
|
||||||
|
dhallToYaml Options{..} mFilePath code = do
|
||||||
|
|
||||||
|
let explaining = if explain then Dhall.detailed else id
|
||||||
|
|
||||||
|
json <- omission <$> explaining (codeToValue conversion UseYAMLEncoding mFilePath code)
|
||||||
|
|
||||||
|
return $ jsonToYaml json documents quoted
|
||||||
|
|
||||||
|
-- | Transform json representation into yaml
|
||||||
|
jsonToYaml
|
||||||
|
:: Data.Aeson.Value
|
||||||
|
-> Bool
|
||||||
|
-> Bool
|
||||||
|
-> ByteString
|
||||||
|
jsonToYaml json documents quoted =
|
||||||
|
case (documents, json) of
|
||||||
|
(True, Data.Aeson.Array elems)
|
||||||
|
-> Data.ByteString.intercalate "\n---\n"
|
||||||
|
$ fmap (Data.ByteString.Lazy.toStrict. (Data.YAML.Aeson.encodeValue' schemaEncoder YT.UTF8). (:[]))
|
||||||
|
$ Data.Vector.toList elems
|
||||||
|
_ -> Data.ByteString.Lazy.toStrict (Data.YAML.Aeson.encodeValue' schemaEncoder YT.UTF8 [json])
|
||||||
|
where
|
||||||
|
style (Y.SStr s)
|
||||||
|
| "\n" `Text.isInfixOf` s =
|
||||||
|
Right (YE.untagged, YE.Literal YE.Clip YE.IndentAuto, s)
|
||||||
|
| quoted =
|
||||||
|
Right (YE.untagged, YE.SingleQuoted, s)
|
||||||
|
style s =
|
||||||
|
YS.schemaEncoderScalar Y.coreSchemaEncoder s
|
||||||
|
|
||||||
|
schemaEncoder = YS.setScalarStyle style Y.coreSchemaEncoder
|
|
@ -0,0 +1,60 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE OverloadedLists #-}
|
||||||
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
|
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import Data.Monoid ((<>))
|
||||||
|
import Dhall.JSON.Yaml (Options(..))
|
||||||
|
import Test.Tasty (TestTree)
|
||||||
|
|
||||||
|
import qualified Data.ByteString
|
||||||
|
import qualified Data.Text.IO
|
||||||
|
import qualified Dhall.JSON.Yaml
|
||||||
|
import qualified Dhall.Yaml
|
||||||
|
import qualified GHC.IO.Encoding
|
||||||
|
import qualified Test.Tasty
|
||||||
|
import qualified Test.Tasty.ExpectedFailure
|
||||||
|
import qualified Test.Tasty.HUnit
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8
|
||||||
|
|
||||||
|
Test.Tasty.defaultMain testTree
|
||||||
|
|
||||||
|
testTree :: TestTree
|
||||||
|
testTree =
|
||||||
|
Test.Tasty.testGroup "dhall-yaml"
|
||||||
|
[ testDhallToYaml
|
||||||
|
Dhall.JSON.Yaml.defaultOptions
|
||||||
|
"./tasty/data/normal"
|
||||||
|
, testDhallToYaml
|
||||||
|
Dhall.JSON.Yaml.defaultOptions
|
||||||
|
"./tasty/data/special"
|
||||||
|
, Test.Tasty.ExpectedFailure.ignoreTestBecause "#1516" $
|
||||||
|
testDhallToYaml
|
||||||
|
(Dhall.JSON.Yaml.defaultOptions { quoted = True })
|
||||||
|
"./tasty/data/quoted"
|
||||||
|
]
|
||||||
|
|
||||||
|
testDhallToYaml :: Options -> String -> TestTree
|
||||||
|
testDhallToYaml options prefix =
|
||||||
|
Test.Tasty.testGroup prefix
|
||||||
|
[ testCase Dhall.Yaml.dhallToYaml "HsYAML"
|
||||||
|
, testCase Dhall.JSON.Yaml.dhallToYaml "aeson-yaml"
|
||||||
|
]
|
||||||
|
where
|
||||||
|
testCase dhallToYaml s = Test.Tasty.HUnit.testCase s $ do
|
||||||
|
let inputFile = prefix <> ".dhall"
|
||||||
|
let outputFile = prefix <> ".yaml"
|
||||||
|
|
||||||
|
text <- Data.Text.IO.readFile inputFile
|
||||||
|
|
||||||
|
actualValue <- dhallToYaml options (Just inputFile) text
|
||||||
|
|
||||||
|
expectedValue <- Data.ByteString.readFile outputFile
|
||||||
|
|
||||||
|
let message = "Conversion to YAML did not generate the expected output"
|
||||||
|
|
||||||
|
Test.Tasty.HUnit.assertEqual message expectedValue actualValue
|
|
@ -30,7 +30,7 @@ import qualified Options.Applicative as Options
|
||||||
import qualified System.Console.ANSI as ANSI
|
import qualified System.Console.ANSI as ANSI
|
||||||
import qualified System.Exit
|
import qualified System.Exit
|
||||||
import qualified System.IO as IO
|
import qualified System.IO as IO
|
||||||
import qualified Paths_dhall_json as Meta
|
import qualified Paths_dhall_yaml as Meta
|
||||||
|
|
||||||
-- ---------------
|
-- ---------------
|
||||||
-- Command options
|
-- Command options
|
|
@ -0,0 +1,22 @@
|
||||||
|
{ mkDerivation, aeson, base, bytestring, stdenv, string-qq, tasty
|
||||||
|
, tasty-discover, tasty-hunit, text, unordered-containers, vector
|
||||||
|
, yaml
|
||||||
|
}:
|
||||||
|
mkDerivation {
|
||||||
|
pname = "aeson-yaml";
|
||||||
|
version = "1.0.4.0";
|
||||||
|
sha256 = "7a6ddaad23f50dc7b419707e49904ad3b5ea9fcd29d2cae0e4adaf300fbb8264";
|
||||||
|
isLibrary = true;
|
||||||
|
isExecutable = true;
|
||||||
|
libraryHaskellDepends = [
|
||||||
|
aeson base bytestring text unordered-containers vector
|
||||||
|
];
|
||||||
|
testHaskellDepends = [
|
||||||
|
aeson base bytestring string-qq tasty tasty-discover tasty-hunit
|
||||||
|
unordered-containers yaml
|
||||||
|
];
|
||||||
|
testToolDepends = [ tasty-discover ];
|
||||||
|
homepage = "https://github.com/clovyr/aeson-yaml";
|
||||||
|
description = "Output any Aeson value as YAML (pure Haskell library)";
|
||||||
|
license = stdenv.lib.licenses.bsd3;
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ let
|
||||||
"dhall-json"
|
"dhall-json"
|
||||||
"dhall-lsp-server"
|
"dhall-lsp-server"
|
||||||
"dhall-nix"
|
"dhall-nix"
|
||||||
|
"dhall-yaml"
|
||||||
];
|
];
|
||||||
|
|
||||||
mass = function: names: haskellPackagesNew: haskellPackagesOld:
|
mass = function: names: haskellPackagesNew: haskellPackagesOld:
|
||||||
|
@ -167,6 +168,7 @@ let
|
||||||
# to ../dhall/dhall-lang/
|
# to ../dhall/dhall-lang/
|
||||||
# "dhall-lsp-server"
|
# "dhall-lsp-server"
|
||||||
"dhall-nix"
|
"dhall-nix"
|
||||||
|
"dhall-yaml"
|
||||||
]
|
]
|
||||||
# Test suite doesn't work on GHCJS or GHC 7.10.3
|
# Test suite doesn't work on GHCJS or GHC 7.10.3
|
||||||
++ pkgsNew.lib.optional (!(compiler == "ghcjs" || compiler == "ghc7103")) "dhall"
|
++ pkgsNew.lib.optional (!(compiler == "ghcjs" || compiler == "ghc7103")) "dhall"
|
||||||
|
@ -182,6 +184,7 @@ let
|
||||||
"dhall-json"
|
"dhall-json"
|
||||||
"dhall-lsp-server"
|
"dhall-lsp-server"
|
||||||
"dhall-nix"
|
"dhall-nix"
|
||||||
|
"dhall-yaml"
|
||||||
];
|
];
|
||||||
|
|
||||||
failOnMissingHaddocksExtension =
|
failOnMissingHaddocksExtension =
|
||||||
|
@ -216,6 +219,12 @@ let
|
||||||
(pkgsNew.sdist ../dhall-bash)
|
(pkgsNew.sdist ../dhall-bash)
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
dhall-json =
|
||||||
|
haskellPackagesNew.callCabal2nix
|
||||||
|
"dhall-json"
|
||||||
|
(pkgsNew.sdist ../dhall-json)
|
||||||
|
{ };
|
||||||
|
|
||||||
dhall-nix =
|
dhall-nix =
|
||||||
haskellPackagesNew.callCabal2nix
|
haskellPackagesNew.callCabal2nix
|
||||||
"dhall-nix"
|
"dhall-nix"
|
||||||
|
@ -228,39 +237,11 @@ let
|
||||||
(pkgsNew.sdist ../dhall-lsp-server)
|
(pkgsNew.sdist ../dhall-lsp-server)
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
dhall-json =
|
dhall-yaml =
|
||||||
# Replace this with
|
haskellPackagesNew.callCabal2nix
|
||||||
# `haskellPackagesNew.callCabal2nixWithOptions` once we
|
"dhall-yaml"
|
||||||
# upgrade to a newer version of Nixpkgs
|
(pkgsNew.sdist ../dhall-yaml)
|
||||||
let
|
{ };
|
||||||
src = pkgsNew.sdist ../dhall-json;
|
|
||||||
|
|
||||||
filter = path: type:
|
|
||||||
pkgsNew.lib.hasSuffix "dhall-json.cabal" path;
|
|
||||||
|
|
||||||
expr =
|
|
||||||
haskellPackagesNew.haskellSrc2nix {
|
|
||||||
name = "dhall-json";
|
|
||||||
|
|
||||||
src =
|
|
||||||
if pkgsNew.lib.canCleanSource src
|
|
||||||
then pkgsNew.lib.cleanSourceWith { inherit src filter; }
|
|
||||||
else src;
|
|
||||||
|
|
||||||
extraCabal2nixOptions = "-fgpl";
|
|
||||||
};
|
|
||||||
|
|
||||||
drv = haskellPackagesNew.callPackage expr {};
|
|
||||||
|
|
||||||
in
|
|
||||||
pkgsNew.haskell.lib.overrideCabal drv (old: {
|
|
||||||
inherit src;
|
|
||||||
|
|
||||||
preConfigure = ''
|
|
||||||
# Generated from ${expr}
|
|
||||||
${old.preConfigure or ""}
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
|
|
||||||
dhall-try =
|
dhall-try =
|
||||||
pkgsNew.haskell.lib.overrideCabal
|
pkgsNew.haskell.lib.overrideCabal
|
||||||
|
@ -587,6 +568,9 @@ let
|
||||||
|
|
||||||
dhall-nix-static =
|
dhall-nix-static =
|
||||||
pkgsNew.haskell.lib.statify haskellPackagesOld.dhall-nix;
|
pkgsNew.haskell.lib.statify haskellPackagesOld.dhall-nix;
|
||||||
|
|
||||||
|
dhall-yaml-static =
|
||||||
|
pkgsNew.haskell.lib.statify haskellPackagesOld.dhall-yaml;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -632,6 +616,7 @@ let
|
||||||
dhall-json = makeStaticIfPossible "dhall-json" ;
|
dhall-json = makeStaticIfPossible "dhall-json" ;
|
||||||
dhall-lsp-server = makeStaticIfPossible "dhall-lsp-server";
|
dhall-lsp-server = makeStaticIfPossible "dhall-lsp-server";
|
||||||
dhall-nix = makeStaticIfPossible "dhall-nix" ;
|
dhall-nix = makeStaticIfPossible "dhall-nix" ;
|
||||||
|
dhall-yaml = makeStaticIfPossible "dhall-yaml" ;
|
||||||
};
|
};
|
||||||
|
|
||||||
toDockerImage = name:
|
toDockerImage = name:
|
||||||
|
@ -659,6 +644,7 @@ in
|
||||||
tarball-dhall-json = makeTarball "dhall-json" ;
|
tarball-dhall-json = makeTarball "dhall-json" ;
|
||||||
tarball-dhall-lsp-server = makeTarball "dhall-lsp-server";
|
tarball-dhall-lsp-server = makeTarball "dhall-lsp-server";
|
||||||
tarball-dhall-nix = makeTarball "dhall-nix" ;
|
tarball-dhall-nix = makeTarball "dhall-nix" ;
|
||||||
|
tarball-dhall-yaml = makeTarball "dhall-yaml" ;
|
||||||
|
|
||||||
inherit (pkgs) tarball-website website;
|
inherit (pkgs) tarball-website website;
|
||||||
|
|
||||||
|
@ -670,6 +656,7 @@ in
|
||||||
dhall-lsp-server
|
dhall-lsp-server
|
||||||
dhall-nix
|
dhall-nix
|
||||||
dhall-try
|
dhall-try
|
||||||
|
dhall-yaml
|
||||||
;
|
;
|
||||||
|
|
||||||
inherit (pkgs.releaseTools) aggregate;
|
inherit (pkgs.releaseTools) aggregate;
|
||||||
|
@ -680,12 +667,14 @@ in
|
||||||
shell-dhall-lsp-server = pkgs.haskell.packages."${compiler}".dhall-lsp-server.env;
|
shell-dhall-lsp-server = pkgs.haskell.packages."${compiler}".dhall-lsp-server.env;
|
||||||
shell-dhall-nix = pkgs.haskell.packages."${compiler}".dhall-nix.env ;
|
shell-dhall-nix = pkgs.haskell.packages."${compiler}".dhall-nix.env ;
|
||||||
shell-dhall-try = pkgs.haskell.packages."${compiler}".dhall-try.env ;
|
shell-dhall-try = pkgs.haskell.packages."${compiler}".dhall-try.env ;
|
||||||
|
shell-dhall-yaml = pkgs.haskell.packages."${compiler}".dhall-yaml.env ;
|
||||||
|
|
||||||
image-dhall = toDockerImage "dhall" ;
|
image-dhall = toDockerImage "dhall" ;
|
||||||
image-dhall-bash = toDockerImage "dhall-bash" ;
|
image-dhall-bash = toDockerImage "dhall-bash" ;
|
||||||
image-dhall-json = toDockerImage "dhall-json" ;
|
image-dhall-json = toDockerImage "dhall-json" ;
|
||||||
image-dhall-lsp-server = toDockerImage "dhall-lsp-server";
|
image-dhall-lsp-server = toDockerImage "dhall-lsp-server";
|
||||||
image-dhall-nix = toDockerImage "dhall-nix" ;
|
image-dhall-nix = toDockerImage "dhall-nix" ;
|
||||||
|
image-dhall-yaml = toDockerImage "dhall-yaml" ;
|
||||||
|
|
||||||
test-dhall =
|
test-dhall =
|
||||||
pkgs.mkShell
|
pkgs.mkShell
|
||||||
|
|
10
release.nix
10
release.nix
|
@ -30,7 +30,9 @@ in
|
||||||
# of the compiler
|
# of the compiler
|
||||||
shared_7_10_3.dhall
|
shared_7_10_3.dhall
|
||||||
shared_7_10_3.dhall-bash
|
shared_7_10_3.dhall-bash
|
||||||
# shared_7_10_3.dhall-json
|
shared_7_10_3.dhall-json
|
||||||
|
# `HsYAML-aeson` requires Cabal >= 2.2
|
||||||
|
# shared_7_10_3.dhall-yaml
|
||||||
# `base-noprelude` depends on a specific version of `base`
|
# `base-noprelude` depends on a specific version of `base`
|
||||||
# shared_7_10_3.dhall-lsp-server
|
# shared_7_10_3.dhall-lsp-server
|
||||||
# `hnix` depends on `lens-family-th`, which doesn't support GHC 7.10.3
|
# `hnix` depends on `lens-family-th`, which doesn't support GHC 7.10.3
|
||||||
|
@ -41,6 +43,7 @@ in
|
||||||
shared_8_6_1.dhall
|
shared_8_6_1.dhall
|
||||||
shared_8_6_1.dhall-bash
|
shared_8_6_1.dhall-bash
|
||||||
shared_8_6_1.dhall-json
|
shared_8_6_1.dhall-json
|
||||||
|
shared_8_6_1.dhall-yaml
|
||||||
# `base-noprelude` depends on a specific version of `base`
|
# `base-noprelude` depends on a specific version of `base`
|
||||||
# shared_8_6_1.dhall-lsp-server
|
# shared_8_6_1.dhall-lsp-server
|
||||||
# `hnix` depends on `unix-2.7.*` and doesn't work with GHC 8.6
|
# `hnix` depends on `unix-2.7.*` and doesn't work with GHC 8.6
|
||||||
|
@ -55,12 +58,14 @@ in
|
||||||
shared.tarball-dhall-json
|
shared.tarball-dhall-json
|
||||||
shared.tarball-dhall-lsp-server
|
shared.tarball-dhall-lsp-server
|
||||||
shared.tarball-dhall-nix
|
shared.tarball-dhall-nix
|
||||||
|
shared.tarball-dhall-yaml
|
||||||
|
|
||||||
shared_ghcjs.tarball-website
|
shared_ghcjs.tarball-website
|
||||||
|
|
||||||
# This is the only `dhall` build that runs the test suite
|
# This is the only `dhall` build that runs the test suite
|
||||||
coverage.dhall
|
coverage.dhall
|
||||||
coverage.dhall-json
|
coverage.dhall-json
|
||||||
|
coverage.dhall-yaml
|
||||||
|
|
||||||
# Check that the package builds with HTTP support compiled out
|
# Check that the package builds with HTTP support compiled out
|
||||||
shared.dhall-no-http
|
shared.dhall-no-http
|
||||||
|
@ -79,6 +84,7 @@ in
|
||||||
tarball-dhall-json
|
tarball-dhall-json
|
||||||
tarball-dhall-lsp-server
|
tarball-dhall-lsp-server
|
||||||
tarball-dhall-nix
|
tarball-dhall-nix
|
||||||
|
tarball-dhall-yaml
|
||||||
;
|
;
|
||||||
|
|
||||||
linux-dhall = shared_linux.possibly-static.dhall;
|
linux-dhall = shared_linux.possibly-static.dhall;
|
||||||
|
@ -86,6 +92,7 @@ in
|
||||||
linux-dhall-json = shared_linux.possibly-static.dhall-json;
|
linux-dhall-json = shared_linux.possibly-static.dhall-json;
|
||||||
linux-dhall-lsp-server = shared_linux.possibly-static.dhall-lsp-server;
|
linux-dhall-lsp-server = shared_linux.possibly-static.dhall-lsp-server;
|
||||||
linux-dhall-nix = shared_linux.possibly-static.dhall-nix;
|
linux-dhall-nix = shared_linux.possibly-static.dhall-nix;
|
||||||
|
linux-dhall-yaml = shared_linux.possibly-static.dhall-yaml;
|
||||||
|
|
||||||
inherit (shared_linux)
|
inherit (shared_linux)
|
||||||
image-dhall
|
image-dhall
|
||||||
|
@ -93,5 +100,6 @@ in
|
||||||
image-dhall-json
|
image-dhall-json
|
||||||
image-dhall-lsp-server
|
image-dhall-lsp-server
|
||||||
image-dhall-nix
|
image-dhall-nix
|
||||||
|
image-dhall-yaml
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ function release {
|
||||||
|
|
||||||
release dhall-lsp-server 1.0.2
|
release dhall-lsp-server 1.0.2
|
||||||
release dhall-json 1.5.0
|
release dhall-json 1.5.0
|
||||||
|
release dhall-yaml 1.5.0
|
||||||
release dhall-bash 1.0.24
|
release dhall-bash 1.0.24
|
||||||
release dhall-nix 1.1.9
|
release dhall-nix 1.1.9
|
||||||
release dhall 1.27.0
|
release dhall 1.27.0
|
||||||
|
|
15
shell.nix
15
shell.nix
|
@ -9,6 +9,7 @@ shared.pkgs.runCommand "dhall-shell-${shell}" {
|
||||||
static.dhall-json
|
static.dhall-json
|
||||||
static.dhall-bash
|
static.dhall-bash
|
||||||
static.dhall-nix
|
static.dhall-nix
|
||||||
|
static.dhall-yaml
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
echo "Dhall core tools shell"
|
echo "Dhall core tools shell"
|
||||||
|
@ -20,11 +21,13 @@ shared.pkgs.runCommand "dhall-shell-${shell}" {
|
||||||
echo " Overriding option completion shell flavor:"
|
echo " Overriding option completion shell flavor:"
|
||||||
echo " $ nix-shell --argstr shell zsh"
|
echo " $ nix-shell --argstr shell zsh"
|
||||||
|
|
||||||
source <(dhall --${shell}-completion-script dhall)
|
source <(dhall --${shell}-completion-script dhall)
|
||||||
source <(dhall-to-bash --${shell}-completion-script dhall-to-bash)
|
source <(dhall-to-bash --${shell}-completion-script dhall-to-bash)
|
||||||
source <(dhall-to-nix --${shell}-completion-script dhall-to-nix)
|
source <(dhall-to-nix --${shell}-completion-script dhall-to-nix)
|
||||||
source <(dhall-to-json --${shell}-completion-script dhall-to-json)
|
source <(dhall-to-json --${shell}-completion-script dhall-to-json)
|
||||||
source <(dhall-to-yaml --${shell}-completion-script dhall-to-yaml)
|
source <(dhall-to-yaml --${shell}-completion-script dhall-to-yaml)
|
||||||
source <(json-to-dhall --${shell}-completion-script json-to-dhall)
|
source <(dhall-to-yaml-ng --${shell}-completion-script dhall-to-yaml-ng)
|
||||||
|
source <(json-to-dhall --${shell}-completion-script json-to-dhall)
|
||||||
|
source <(yaml-to-dhall --${shell}-completion-script yaml-to-dhall)
|
||||||
'';
|
'';
|
||||||
} ""
|
} ""
|
||||||
|
|
|
@ -5,6 +5,7 @@ packages:
|
||||||
- dhall-json
|
- dhall-json
|
||||||
- dhall-nix
|
- dhall-nix
|
||||||
- dhall-lsp-server
|
- dhall-lsp-server
|
||||||
|
- dhall-yaml
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- th-lift-instances-0.1.13@sha256:2852e468511805cb25d9e3923c9e91647d008ab4a764ec0921e5e40ff8a8e874,2625
|
- th-lift-instances-0.1.13@sha256:2852e468511805cb25d9e3923c9e91647d008ab4a764ec0921e5e40ff8a8e874,2625
|
||||||
- th-lift-0.8.0.1@sha256:cceb81b12c0580e02a7a3898b6d60cca5e1be080741f69ddde4f12210d8ba7ca,1960
|
- th-lift-0.8.0.1@sha256:cceb81b12c0580e02a7a3898b6d60cca5e1be080741f69ddde4f12210d8ba7ca,1960
|
||||||
|
@ -21,10 +22,7 @@ extra-deps:
|
||||||
- HsYAML-aeson-0.2.0.0@sha256:04796abfc01cffded83f37a10e6edba4f0c0a15d45bef44fc5bb4313d9c87757,1791
|
- HsYAML-aeson-0.2.0.0@sha256:04796abfc01cffded83f37a10e6edba4f0c0a15d45bef44fc5bb4313d9c87757,1791
|
||||||
- ordered-containers-0.2.2@sha256:ebf2be3f592d9cf148ea6b8375f8af97148d44f82d8d04476899285e965afdbf,810
|
- ordered-containers-0.2.2@sha256:ebf2be3f592d9cf148ea6b8375f8af97148d44f82d8d04476899285e965afdbf,810
|
||||||
- lsp-test-0.6.1.0@sha256:df0fc403c03b6d036be13de3ff23d9951ae2506080135cd6862eded2c969a6da,3483
|
- lsp-test-0.6.1.0@sha256:df0fc403c03b6d036be13de3ff23d9951ae2506080135cd6862eded2c969a6da,3483
|
||||||
- aeson-yaml-1.0.2.0@sha256:c578472845478a35756131f4f4a6a929a9021aa2e494e6efe610c033e09868d0,1975
|
- aeson-yaml-1.0.4.0@sha256:72d91a4a2ade87b8a4bdf73937d2c62bd2c60053df1841f8bf1e6204387959b8,1975
|
||||||
flags:
|
|
||||||
dhall-json:
|
|
||||||
gpl: true
|
|
||||||
nix:
|
nix:
|
||||||
packages:
|
packages:
|
||||||
- ncurses
|
- ncurses
|
||||||
|
|
Loading…
Reference in New Issue