dhall-nix 1.1.8 → 1.1.9
raw patch · 3 files changed
+33/−9 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.Nix: dhallToNix :: Expr s X -> Either CompileError (Fix NExprF)
+ Dhall.Nix: dhallToNix :: Expr s Void -> Either CompileError (Fix NExprF)
Files
- dhall-nix.cabal +7/−3
- exec/Main.hs +20/−1
- src/Dhall/Nix.hs +6/−5
dhall-nix.cabal view
@@ -1,5 +1,5 @@ Name: dhall-nix-Version: 1.1.8+Version: 1.1.9 Cabal-Version: >=1.8.0.2 Build-Type: Simple Tested-With: GHC == 8.0.1@@ -30,19 +30,23 @@ base >= 4.8.0.0 && < 5 , containers < 0.7 , data-fix < 0.3 ,- dhall >= 1.26 && < 1.27,+ dhall >= 1.27 && < 1.28, hnix >= 0.6.1 && < 0.7 , neat-interpolation < 0.4 , text >= 0.8.0.0 && < 1.3 Exposed-Modules: Dhall.Nix GHC-Options: -Wall- if os(windows)+ if os(windows) || impl(eta) Buildable: False Executable dhall-to-nix+ if os(windows) || impl(eta)+ Buildable: False Hs-Source-Dirs: exec Main-Is: Main.hs+ Other-Modules:+ Paths_dhall_nix Build-Depends: base , dhall ,
exec/Main.hs view
@@ -1,12 +1,19 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TypeOperators #-} module Main where import Control.Exception (SomeException)+import Options.Generic (Generic, ParseRecord, type (<?>)(..)) import System.Exit (ExitCode(..)) import qualified Control.Exception import qualified Data.Text.IO+import qualified Data.Version import qualified Dhall import qualified Dhall.Import import qualified Dhall.Nix@@ -15,13 +22,25 @@ import qualified GHC.IO.Encoding import qualified Nix.Pretty import qualified Options.Generic+import qualified Paths_dhall_nix import qualified System.Exit import qualified System.IO +data Options = Options+ { version :: Bool+ <?> "Display version"+ } deriving (Generic, ParseRecord)+ main :: IO () main = handle (Dhall.detailed (do GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8- () <- Options.Generic.getRecord "Compile Dhall to Nix"+ Options{..} <- Options.Generic.getRecord "Compile Dhall to Nix"++ if unHelpful version+ then do+ putStrLn (Data.Version.showVersion Paths_dhall_nix.version)+ System.Exit.exitSuccess+ else return () inText <- Data.Text.IO.getContents
src/Dhall/Nix.hs view
@@ -95,9 +95,8 @@ import Data.Fix (Fix(..)) import Data.Traversable (for) import Data.Typeable (Typeable)-import Data.Void (absurd)-import Dhall.Core (Chunks(..), Const(..), Expr(..), MultiLet(..), Var(..))-import Dhall.TypeCheck (X)+import Data.Void (Void, absurd)+import Dhall.Core (Chunks(..), Const(..), DhallDouble(..), Expr(..), MultiLet(..), Var(..)) import Nix.Atoms (NAtom(..)) import Nix.Expr ( Antiquoted(..)@@ -206,7 +205,7 @@ Precondition: You must first type-check the Dhall expression before passing the expression to `dhallToNix` -}-dhallToNix :: Expr s X -> Either CompileError (Fix NExprF)+dhallToNix :: Expr s Void -> Either CompileError (Fix NExprF) dhallToNix e = loop (Dhall.Core.normalize e) where loop (Const _) = return (Fix (NSet []))@@ -331,7 +330,7 @@ loop IntegerToDouble = do return (Fix (NAbs "x" "x")) loop Double = return (Fix (NSet []))- loop (DoubleLit n) = return (Fix (NConstant (NFloat (realToFrac n))))+ loop (DoubleLit (DhallDouble n)) = return (Fix (NConstant (NFloat (realToFrac n)))) loop DoubleShow = do return "toString" loop Text = return (Fix (NSet []))@@ -515,6 +514,8 @@ a' <- loop a b' <- loop b return (Fix (NBinary NUpdate a' b'))+ loop (RecordCompletion a b) = do+ loop (Annot (Prefer (Field a "default") b) (Field a "Type")) loop (Field (Union kts) k) = case Dhall.Map.lookup k kts of -- If the selected alternative has an associated payload, then we