dhall-nix 1.1.25 → 1.1.26
raw patch · 3 files changed
+36/−15 lines, 3 filesdep ~containersdep ~dhalldep ~hnix
Dependency ranges changed: containers, dhall, hnix, optparse-generic, text
Files
- LICENSE +2/−2
- dhall-nix.cabal +8/−8
- src/Dhall/Nix.hs +26/−5
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2020 Gabriel Gonzalez+Copyright (c) 2020 Gabriella Gonzalez All rights reserved. Redistribution and use in source and binary forms, with or without modification,@@ -8,7 +8,7 @@ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.- * Neither the name of Gabriel Gonzalez nor the names of other contributors+ * Neither the name of Gabriella Gonzalez nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.
dhall-nix.cabal view
@@ -1,13 +1,13 @@ Name: dhall-nix-Version: 1.1.25+Version: 1.1.26 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3 License-File: LICENSE-Copyright: 2017 Gabriel Gonzalez-Author: Gabriel Gonzalez-Maintainer: Gabriel439@gmail.com-Bug-Reports: https://github.com/Gabriel439/Haskell-Dhall-Nix-Library/issues+Copyright: 2017 Gabriella Gonzalez+Author: Gabriella Gonzalez+Maintainer: GenuineGabriella@gmail.com+Bug-Reports: https://github.com/dhall-lang/dhall-haskell/issues Synopsis: Dhall to Nix compiler Description: Use this package if you want to compile Dhall expressions to the Nix language.@@ -21,7 +21,7 @@ Category: Compiler Source-Repository head Type: git- Location: https://github.com/Gabriel439/Haskell-Dhall-Nix-Library+ Location: https://github.com/dhall-lang/dhall-haskell Library Hs-Source-Dirs: src@@ -29,8 +29,8 @@ base >= 4.11.0.0 && < 5 , containers < 0.7 , data-fix < 0.4 ,- dhall >= 1.41 && < 1.42,- hnix >= 0.7 && < 0.15,+ dhall >= 1.42 && < 1.43,+ hnix >= 0.16 && < 0.17, lens-family-core >= 1.0.0 && < 2.2 , neat-interpolation < 0.6 , text >= 0.8.0.0 && < 2.1
src/Dhall/Nix.hs view
@@ -121,11 +121,12 @@ ( Antiquoted (..) , NExpr , NExprF (NStr, NSet)- , NRecordType (NNonRecursive)+ , Recursivity (NonRecursive) , Binding (NamedVar) , NKeyName (..) , NString (..) , Params (Param)+ , VarName(..) , ($!=) , ($&&) , ($*)@@ -162,6 +163,9 @@ -- ^ We currently do not support threading around type information | CannotShowConstructor -- ^ We currently do not support the `showConstructor` keyword+ | BytesUnsupported+ -- ^ The Nix language does not support arbitrary bytes (most notably: null+ -- bytes) deriving (Typeable) instance Show CompileError where@@ -236,6 +240,13 @@ an internal error in ❰dhall-to-nix❱ that you should report. |] + show BytesUnsupported =+ Data.Text.unpack [NeatInterpolation.text|+$_ERROR: Cannot translate ❰Bytes❱ to Nix++Explanation: The Nix language does not support bytes literals+ |]+ _ERROR :: Data.Text.Text _ERROR = "\ESC[1;31mError\ESC[0m" @@ -329,7 +340,7 @@ loop (Var a ) = Left (CannotReferenceShadowedVariable a) loop (Lam _ FunctionBinding { functionBindingVariable = a } c) = do c' <- loop c- return (Param a ==> c')+ return (Param (VarName a) ==> c') loop (Pi _ _ _ _) = return untranslatable loop (App None _) = return Nix.mkNull@@ -375,6 +386,9 @@ b' <- loop b c' <- loop c return (Nix.mkIf a' b' c')+ loop Bytes = return untranslatable+ loop (BytesLit _) = do+ Left BytesUnsupported loop Natural = return untranslatable loop (NaturalLit n) = return (Nix.mkInt (fromIntegral n)) loop NaturalFold = do@@ -595,6 +609,14 @@ loop DateLiteral{} = undefined loop TimeLiteral{} = undefined loop TimeZoneLiteral{} = undefined+ -- We currently model `Date`/`Time`/`TimeZone` literals as strings in Nix,+ -- so the corresponding show functions are the identity function+ loop DateShow =+ return ("date" ==> "date")+ loop TimeShow =+ return ("time" ==> "time")+ loop TimeZoneShow =+ return ("timeZone" ==> "timeZone") loop (Record _) = return untranslatable loop (RecordLit a) = do a' <- traverse (loop . Dhall.Core.recordFieldValue) a@@ -603,7 +625,7 @@ -- nonrecursive attrset that uses correctly quoted keys -- see https://github.com/dhall-lang/dhall-haskell/issues/2414 nixAttrs pairs =- Fix $ NSet NNonRecursive $+ Fix $ NSet NonRecursive $ (\(key, val) -> NamedVar (DynamicKey (Plain (DoubleQuoted [Plain key])) :| []) val Nix.nullPos) <$> pairs loop (Union _) = return untranslatable@@ -709,8 +731,7 @@ return (a' @. b) loop (Project a (Left b)) = do a' <- loop a- let b' = fmap StaticKey (toList b)- return (Nix.mkNonRecSet [ Nix.inheritFrom a' b' Nix.nullPos ])+ return (Nix.mkNonRecSet [ Nix.inheritFrom a' (fmap VarName b) ]) loop (Project _ (Right _)) = Left CannotProjectByType loop (Assert _) =