packages feed

dhall-nix 1.1.16 → 1.1.17

raw patch · 2 files changed

+15/−10 lines, 2 filesdep ~dhalldep ~hnixPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: dhall, hnix

API changes (from Hackage documentation)

- Dhall.Nix: instance GHC.Exception.Exception Dhall.Nix.CompileError
+ Dhall.Nix: instance GHC.Exception.Type.Exception Dhall.Nix.CompileError

Files

dhall-nix.cabal view
@@ -1,5 +1,5 @@ Name: dhall-nix-Version: 1.1.16+Version: 1.1.17 Cabal-Version: >=1.10 Build-Type: Simple Tested-With: GHC == 8.0.1@@ -30,7 +30,7 @@         base                      >= 4.11.0.0 && < 5   ,         containers                               < 0.7 ,         data-fix                                 < 0.4 ,-        dhall                     >= 1.34     && < 1.35,+        dhall                     >= 1.35     && < 1.36,         hnix                      >= 0.7      && < 0.10,         lens-family-core          >= 1.0.0    && < 2.2 ,         neat-interpolation                       < 0.6 ,
src/Dhall/Nix.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE QuasiQuotes        #-} {-# LANGUAGE RecordWildCards    #-} {-# LANGUAGE TypeFamilies       #-}+{-# LANGUAGE ViewPatterns       #-}  {-| This library only exports a single `dhallToNix` function for translating a     Dhall syntax tree to a Nix syntax tree for the @hnix@ library@@ -103,6 +104,7 @@     , Chunks (..)     , DhallDouble (..)     , Expr (..)+    , FunctionBinding (..)     , MultiLet (..)     , PreferAnnotation (..)     , Var (..)@@ -236,7 +238,7 @@     -- If any other number, then rename the variable to include the maximum     -- depth.     maximumDepth :: Var -> Expr s Void -> Maybe Int-    maximumDepth v@(V x n) (Lam x' a b)+    maximumDepth v@(V x n) (Lam FunctionBinding {functionBindingVariable = x', functionBindingAnnotation = a} b)         | x == x' =             max (maximumDepth v a) (fmap (+ 1) (maximumDepth (V x (n + 1)) b))     maximumDepth v@(V x n) (Pi x' a b)@@ -271,10 +273,10 @@                 x' = x <> Data.Text.pack (show n)      renameShadowed :: Expr s Void -> Maybe (Expr s Void)-    renameShadowed (Lam x a b) = do+    renameShadowed (Lam FunctionBinding { functionBindingVariable = x, functionBindingAnnotation = a} b) = do         (x', b') <- rename (x, b) -        return (Lam x' a b')+        return (Lam (Dhall.Core.makeFunctionBinding x' a) b')     renameShadowed (Pi x a b) = do         (x', b') <- rename (x, b) @@ -293,14 +295,14 @@     loop (Const _) = return untranslatable     loop (Var (V a 0)) = return (Fix (NSym a))     loop (Var  a     ) = Left (CannotReferenceShadowedVariable a)-    loop (Lam a _ c) = do+    loop (Lam FunctionBinding { functionBindingVariable = a } c) = do         c' <- loop c         return (Fix (NAbs (Param a) c'))     loop (Pi _ _ _) = return untranslatable     -- None needs a type to convert to an Optional     loop (App None _) =       return (Fix (NConstant NNull))-    loop (App (Field (Union kts) k) v) = do+    loop (App (Field (Union kts) (Dhall.Core.fieldSelectionLabel -> k)) v) = do         v' <- loop v         let e0 = do                 k' <- Dhall.Map.keys kts@@ -593,8 +595,11 @@         c' <- loop c         return (Fix (NBinary NUpdate b' c'))     loop (RecordCompletion a b) =-        loop (Annot (Prefer PreferFromCompletion (Field a "default") b) (Field a "Type"))-    loop (Field (Union kts) k) =+        loop (Annot (Prefer PreferFromCompletion (Field a def) b) (Field a typ))+      where+        def = Dhall.Core.makeFieldSelection "default"+        typ = Dhall.Core.makeFieldSelection "Type"+    loop (Field (Union kts) (Dhall.Core.fieldSelectionLabel -> k)) =         case Dhall.Map.lookup k kts of             -- If the selected alternative has an associated payload, then we             -- need introduce the partial application through an extra abstraction@@ -614,7 +619,7 @@                         return (k', Nothing)                 let e2 = Fix (NSym k)                 return (Fix (NAbs (ParamSet e0 False Nothing) e2))-    loop (Field a b) = do+    loop (Field a (Dhall.Core.fieldSelectionLabel -> b)) = do         a' <- loop a         return (Fix (NSelect a' [StaticKey b] Nothing))     loop (Project a (Left b)) = do