-
Notifications
You must be signed in to change notification settings - Fork 220
Move HsYAML-based code to dhall-yaml #1514
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ in | |
dhall-json | ||
dhall-lsp-server | ||
dhall-nix | ||
dhall-yaml | ||
; | ||
|
||
inherit (shared_ghcjs) dhall-try; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ Cabal-Version: >=1.8.0.2 | |
Build-Type: Simple | ||
Tested-With: GHC == 7.10.3, GHC == 8.4.3, GHC == 8.6.1 | ||
License: BSD3 | ||
License-Files: LICENSE.BSD3, LICENSE.GPLv3 | ||
License-File: LICENSE | ||
Copyright: 2017 Gabriel Gonzalez | ||
Author: Gabriel Gonzalez | ||
Maintainer: [email protected] | ||
|
@@ -26,24 +26,18 @@ Extra-Source-Files: | |
CHANGELOG.md | ||
tasty/data/*.dhall | ||
tasty/data/*.json | ||
tasty/data/*.txt | ||
tasty/data/*.yaml | ||
|
||
Source-Repository head | ||
Type: git | ||
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 | ||
Hs-Source-Dirs: src | ||
Build-Depends: | ||
base >= 4.8.0.0 && < 5 , | ||
aeson >= 1.0.0.0 && < 1.5 , | ||
aeson-pretty < 0.9 , | ||
aeson-yaml >= 1.0.4 && < 1.1 , | ||
bytestring < 0.11, | ||
containers , | ||
dhall >= 1.27.0 && < 1.28, | ||
|
@@ -58,21 +52,11 @@ Library | |
Exposed-Modules: | ||
Dhall.JSON | ||
Dhall.JSONToDhall | ||
Dhall.Yaml | ||
if flag(gpl) | ||
Exposed-Modules: | ||
Dhall.YamlToDhall | ||
Dhall.JSON.Yaml | ||
Dhall.DhallToYaml.Main | ||
Other-Modules: | ||
Dhall.JSON.Util | ||
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 | ||
Hs-Source-Dirs: dhall-to-json | ||
|
@@ -94,13 +78,8 @@ Executable dhall-to-yaml | |
Hs-Source-Dirs: dhall-to-yaml | ||
Main-Is: Main.hs | ||
Build-Depends: | ||
base , | ||
aeson , | ||
bytestring < 0.11, | ||
dhall , | ||
dhall-json , | ||
optparse-applicative , | ||
text | ||
base , | ||
dhall-json | ||
Other-Modules: | ||
Paths_dhall_json | ||
GHC-Options: -Wall | ||
|
@@ -126,39 +105,17 @@ Executable json-to-dhall | |
Paths_dhall_json | ||
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 | ||
Type: exitcode-stdio-1.0 | ||
Hs-Source-Dirs: tasty | ||
Main-Is: Main.hs | ||
Build-Depends: | ||
base, | ||
base , | ||
aeson , | ||
bytestring , | ||
dhall , | ||
dhall-json , | ||
tasty < 1.3, | ||
text , | ||
tasty-hunit >= 0.2 | ||
GHC-Options: -Wall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,8 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
module Main where | ||
|
||
import Control.Applicative (optional, (<|>)) | ||
import Control.Exception (SomeException) | ||
import Data.Monoid ((<>)) | ||
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" | ||
) | ||
import qualified Dhall.DhallToYaml.Main | ||
import qualified Dhall.JSON.Yaml | ||
import qualified Paths_dhall_json as Meta | ||
|
||
main :: IO () | ||
main = do | ||
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 | ||
main = Dhall.DhallToYaml.Main.main Meta.version Dhall.JSON.Yaml.dhallToYaml |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how we're installing the binaries for
dhall-to-nix
,dhall-lsp-server
etc. I only see the--copy-bins
fordhall-json
so far. Does anyone know?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed Travis fails now with:
Could it be that we have distributed ancient cached binaries for OS X so far?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it was just 96e694d that restricted the binary build to
dhall-json
.