dhall-bash 1.0.23 → 1.0.24
raw patch · 3 files changed
+79/−67 lines, 3 filesdep ~dhallPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: dhall
API changes (from Hackage documentation)
- Dhall.Bash: UnsupportedExpression :: Expr X X -> ExpressionError
+ Dhall.Bash: UnsupportedExpression :: Expr Void Void -> ExpressionError
- Dhall.Bash: UnsupportedStatement :: Expr X X -> StatementError
+ Dhall.Bash: UnsupportedStatement :: Expr Void Void -> StatementError
- Dhall.Bash: UnsupportedSubexpression :: Expr X X -> StatementError
+ Dhall.Bash: UnsupportedSubexpression :: Expr Void Void -> StatementError
- Dhall.Bash: dhallToExpression :: Expr s X -> Either ExpressionError ByteString
+ Dhall.Bash: dhallToExpression :: Expr s Void -> Either ExpressionError ByteString
- Dhall.Bash: dhallToStatement :: Expr s X -> ByteString -> Either StatementError ByteString
+ Dhall.Bash: dhallToStatement :: Expr s Void -> ByteString -> Either StatementError ByteString
Files
- dhall-bash.cabal +4/−2
- exec/Main.hs +10/−0
- src/Dhall/Bash.hs +65/−65
dhall-bash.cabal view
@@ -1,5 +1,5 @@ Name: dhall-bash-Version: 1.0.23+Version: 1.0.24 Cabal-Version: >=1.8.0.2 Build-Type: Simple Tested-With: GHC == 7.10.3, GHC == 8.4.3, GHC == 8.6.1@@ -31,7 +31,7 @@ base >= 4.8.0.0 && < 5 , bytestring < 0.11, containers < 0.7 ,- dhall >= 1.26.0 && < 1.27,+ dhall >= 1.27.0 && < 1.28, neat-interpolation < 0.4 , shell-escape < 0.3 , text >= 0.2 && < 1.3@@ -41,6 +41,8 @@ Executable dhall-to-bash Hs-Source-Dirs: exec Main-Is: Main.hs+ Other-Modules:+ Paths_dhall_bash Build-Depends: base , bytestring ,
exec/Main.hs view
@@ -15,6 +15,7 @@ import qualified Control.Exception import qualified Data.ByteString import qualified Data.Text.IO+import qualified Data.Version import qualified Dhall import qualified Dhall.Bash import qualified Dhall.Import@@ -22,6 +23,7 @@ import qualified Dhall.TypeCheck import qualified GHC.IO.Encoding import qualified Options.Generic+import qualified Paths_dhall_bash import qualified System.Exit import qualified System.IO @@ -30,12 +32,20 @@ <?> "Explain error messages in detail" , declare :: Maybe ByteString <?> "Declare the given variable as a statement instead of an expression"+ , version :: Bool+ <?> "Display version" } deriving (Generic, ParseRecord) main :: IO () main = do GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8 Options {..} <- Options.Generic.getRecord "Compile Dhall to Bash"++ if unHelpful version+ then do+ putStrLn (Data.Version.showVersion Paths_dhall_bash.version)+ System.Exit.exitSuccess+ else return () (if unHelpful explain then Dhall.detailed else id) (handle (do inText <- Data.Text.IO.getContents
src/Dhall/Bash.hs view
@@ -105,9 +105,8 @@ import Data.ByteString import Data.Monoid ((<>)) import Data.Typeable (Typeable)-import Data.Void (absurd)+import Data.Void (Void, absurd) import Dhall.Core (Expr(..), Chunks(..))-import Dhall.TypeCheck import qualified Data.Foldable import qualified Data.Text@@ -127,8 +126,8 @@ Bash this just returns the expression that failed -} data StatementError- = UnsupportedStatement (Expr X X)- | UnsupportedSubexpression (Expr X X)+ = UnsupportedStatement (Expr Void Void)+ | UnsupportedSubexpression (Expr Void Void) deriving (Typeable) instance Show StatementError where@@ -170,7 +169,7 @@ Because the majority of Dhall language features do not easily translate to Bash this just returns the expression that failed -}-data ExpressionError = UnsupportedExpression (Expr X X) deriving (Typeable)+data ExpressionError = UnsupportedExpression (Expr Void Void) deriving (Typeable) instance Show ExpressionError where show (UnsupportedExpression e) =@@ -216,7 +215,7 @@ * records -} dhallToStatement- :: Expr s X+ :: Expr s Void -- ^ Dhall expression to compile -> ByteString -- ^ Variable to @declare@ or @unset@@@ -276,64 +275,65 @@ -- Use an exhaustive pattern match here so that we don't forget to handle -- new constructors added to the API- go e@(Const {}) = Left (UnsupportedStatement e)- go e@(Var {}) = Left (UnsupportedStatement e)- go e@(Lam {}) = Left (UnsupportedStatement e)- go e@(Pi {}) = Left (UnsupportedStatement e)- go e@(App {}) = Left (UnsupportedStatement e)- go e@(Let {}) = Left (UnsupportedStatement e)- go e@(Annot {}) = Left (UnsupportedStatement e)- go e@(Bool {}) = Left (UnsupportedStatement e)- go e@(BoolAnd {}) = Left (UnsupportedStatement e)- go e@(BoolOr {}) = Left (UnsupportedStatement e)- go e@(BoolEQ {}) = Left (UnsupportedStatement e)- go e@(BoolNE {}) = Left (UnsupportedStatement e)- go e@(BoolIf {}) = Left (UnsupportedStatement e)- go e@(Natural ) = Left (UnsupportedStatement e)- go e@(NaturalFold ) = Left (UnsupportedStatement e)- go e@(NaturalBuild ) = Left (UnsupportedStatement e)- go e@(NaturalIsZero ) = Left (UnsupportedStatement e)- go e@(NaturalEven ) = Left (UnsupportedStatement e)- go e@(NaturalOdd ) = Left (UnsupportedStatement e)- go e@(NaturalToInteger) = Left (UnsupportedStatement e)- go e@(NaturalShow ) = Left (UnsupportedStatement e)- go e@(NaturalSubtract ) = Left (UnsupportedStatement e)- go e@(NaturalPlus {}) = Left (UnsupportedStatement e)- go e@(NaturalTimes {}) = Left (UnsupportedStatement e)- go e@(Integer ) = Left (UnsupportedStatement e)- go e@(IntegerShow ) = Left (UnsupportedStatement e)- go e@(IntegerToDouble ) = Left (UnsupportedStatement e)- go e@(Double ) = Left (UnsupportedStatement e)- go e@(DoubleLit {}) = Left (UnsupportedStatement e)- go e@(DoubleShow ) = Left (UnsupportedStatement e)- go e@(Text ) = Left (UnsupportedStatement e)- go e@(TextAppend {}) = Left (UnsupportedStatement e)- go e@(TextShow {}) = Left (UnsupportedStatement e)- go e@(List ) = Left (UnsupportedStatement e)- go e@(ListAppend {}) = Left (UnsupportedStatement e)- go e@(ListBuild ) = Left (UnsupportedStatement e)- go e@(ListFold ) = Left (UnsupportedStatement e)- go e@(ListLength ) = Left (UnsupportedStatement e)- go e@(ListHead ) = Left (UnsupportedStatement e)- go e@(ListLast ) = Left (UnsupportedStatement e)- go e@(ListIndexed ) = Left (UnsupportedStatement e)- go e@(ListReverse ) = Left (UnsupportedStatement e)- go e@(Optional ) = Left (UnsupportedStatement e)- go e@(None ) = Left (UnsupportedStatement e)- go e@(OptionalFold ) = Left (UnsupportedStatement e)- go e@(OptionalBuild ) = Left (UnsupportedStatement e)- go e@(Record {}) = Left (UnsupportedStatement e)- go e@(Union {}) = Left (UnsupportedStatement e)- go e@(Combine {}) = Left (UnsupportedStatement e)- go e@(CombineTypes {}) = Left (UnsupportedStatement e)- go e@(Prefer {}) = Left (UnsupportedStatement e)- go e@(Merge {}) = Left (UnsupportedStatement e)- go e@(ToMap {}) = Left (UnsupportedStatement e)- go e@(Field {}) = Left (UnsupportedStatement e)- go e@(Project {}) = Left (UnsupportedStatement e)- go e@(Assert {}) = Left (UnsupportedStatement e)- go e@(Equivalent {}) = Left (UnsupportedStatement e)- go e@(ImportAlt {}) = Left (UnsupportedStatement e)+ go e@(Const {}) = Left (UnsupportedStatement e)+ go e@(Var {}) = Left (UnsupportedStatement e)+ go e@(Lam {}) = Left (UnsupportedStatement e)+ go e@(Pi {}) = Left (UnsupportedStatement e)+ go e@(App {}) = Left (UnsupportedStatement e)+ go e@(Let {}) = Left (UnsupportedStatement e)+ go e@(Annot {}) = Left (UnsupportedStatement e)+ go e@(Bool {}) = Left (UnsupportedStatement e)+ go e@(BoolAnd {}) = Left (UnsupportedStatement e)+ go e@(BoolOr {}) = Left (UnsupportedStatement e)+ go e@(BoolEQ {}) = Left (UnsupportedStatement e)+ go e@(BoolNE {}) = Left (UnsupportedStatement e)+ go e@(BoolIf {}) = Left (UnsupportedStatement e)+ go e@(Natural ) = Left (UnsupportedStatement e)+ go e@(NaturalFold ) = Left (UnsupportedStatement e)+ go e@(NaturalBuild ) = Left (UnsupportedStatement e)+ go e@(NaturalIsZero ) = Left (UnsupportedStatement e)+ go e@(NaturalEven ) = Left (UnsupportedStatement e)+ go e@(NaturalOdd ) = Left (UnsupportedStatement e)+ go e@(NaturalToInteger ) = Left (UnsupportedStatement e)+ go e@(NaturalShow ) = Left (UnsupportedStatement e)+ go e@(NaturalSubtract ) = Left (UnsupportedStatement e)+ go e@(NaturalPlus {}) = Left (UnsupportedStatement e)+ go e@(NaturalTimes {}) = Left (UnsupportedStatement e)+ go e@(Integer ) = Left (UnsupportedStatement e)+ go e@(IntegerShow ) = Left (UnsupportedStatement e)+ go e@(IntegerToDouble ) = Left (UnsupportedStatement e)+ go e@(Double ) = Left (UnsupportedStatement e)+ go e@(DoubleLit {}) = Left (UnsupportedStatement e)+ go e@(DoubleShow ) = Left (UnsupportedStatement e)+ go e@(Text ) = Left (UnsupportedStatement e)+ go e@(TextAppend {}) = Left (UnsupportedStatement e)+ go e@(TextShow {}) = Left (UnsupportedStatement e)+ go e@(List ) = Left (UnsupportedStatement e)+ go e@(ListAppend {}) = Left (UnsupportedStatement e)+ go e@(ListBuild ) = Left (UnsupportedStatement e)+ go e@(ListFold ) = Left (UnsupportedStatement e)+ go e@(ListLength ) = Left (UnsupportedStatement e)+ go e@(ListHead ) = Left (UnsupportedStatement e)+ go e@(ListLast ) = Left (UnsupportedStatement e)+ go e@(ListIndexed ) = Left (UnsupportedStatement e)+ go e@(ListReverse ) = Left (UnsupportedStatement e)+ go e@(Optional ) = Left (UnsupportedStatement e)+ go e@(None ) = Left (UnsupportedStatement e)+ go e@(OptionalFold ) = Left (UnsupportedStatement e)+ go e@(OptionalBuild ) = Left (UnsupportedStatement e)+ go e@(Record {}) = Left (UnsupportedStatement e)+ go e@(Union {}) = Left (UnsupportedStatement e)+ go e@(Combine {}) = Left (UnsupportedStatement e)+ go e@(CombineTypes {}) = Left (UnsupportedStatement e)+ go e@(Prefer {}) = Left (UnsupportedStatement e)+ go e@(RecordCompletion {}) = Left (UnsupportedStatement e)+ go e@(Merge {}) = Left (UnsupportedStatement e)+ go e@(ToMap {}) = Left (UnsupportedStatement e)+ go e@(Field {}) = Left (UnsupportedStatement e)+ go e@(Project {}) = Left (UnsupportedStatement e)+ go e@(Assert {}) = Left (UnsupportedStatement e)+ go e@(Equivalent {}) = Left (UnsupportedStatement e)+ go e@(ImportAlt {}) = Left (UnsupportedStatement e) {-| Compile a Dhall expression to a Bash expression @@ -345,7 +345,7 @@ * @Text@s -} dhallToExpression- :: Expr s X+ :: Expr s Void -- ^ Dhall expression to compile -> Either ExpressionError ByteString -- ^ Bash expression or compile failure