diff --git a/src/Nix/Eval.hs b/src/Nix/Eval.hs index 112e9ecaf..86074f352 100644 --- a/src/Nix/Eval.hs +++ b/src/Nix/Eval.hs @@ -147,14 +147,14 @@ eval (NList l ) = lst <- traverse (defer @v @m . withScopes @v scope) l toValue lst -eval (NSet NNonRecursive binds) = +eval (NSet NonRecursive binds) = do - attrSet <- evalBinds False $ desugarBinds (eval . NSet NNonRecursive) binds + attrSet <- evalBinds False $ desugarBinds (eval . NSet NonRecursive) binds toValue attrSet -eval (NSet NRecursive binds) = +eval (NSet Recursive binds) = do - attrSet <- evalBinds True $ desugarBinds (eval . NSet NNonRecursive) binds + attrSet <- evalBinds True $ desugarBinds (eval . NSet NonRecursive) binds toValue attrSet eval (NLet binds body ) = diff --git a/src/Nix/Expr/Shorthands.hs b/src/Nix/Expr/Shorthands.hs index e5d80f3d4..0556f8695 100644 --- a/src/Nix/Expr/Shorthands.hs +++ b/src/Nix/Expr/Shorthands.hs @@ -98,10 +98,10 @@ mkParamset :: [(Text, Maybe NExpr)] -> Bool -> Params NExpr mkParamset params variadic = ParamSet params variadic mempty mkRecSet :: [Binding NExpr] -> NExpr -mkRecSet = Fix . NSet NRecursive +mkRecSet = Fix . NSet Recursive mkNonRecSet :: [Binding NExpr] -> NExpr -mkNonRecSet = Fix . NSet NNonRecursive +mkNonRecSet = Fix . NSet NonRecursive mkLets :: [Binding NExpr] -> NExpr -> NExpr mkLets bindings = Fix . NLet bindings @@ -177,11 +177,11 @@ letE varName varExpr = letsE [(varName, varExpr)] -- | Make an attribute set (non-recursive). attrsE :: [(Text, NExpr)] -> NExpr -attrsE pairs = Fix $ NSet NNonRecursive $ uncurry bindTo <$> pairs +attrsE pairs = Fix $ NSet NonRecursive $ uncurry bindTo <$> pairs -- | Make an attribute set (recursive). recAttrsE :: [(Text, NExpr)] -> NExpr -recAttrsE pairs = Fix $ NSet NRecursive $ uncurry bindTo <$> pairs +recAttrsE pairs = Fix $ NSet Recursive $ uncurry bindTo <$> pairs -- | Logical negation. mkNot :: NExpr -> NExpr diff --git a/src/Nix/Expr/Types.hs b/src/Nix/Expr/Types.hs index b0999c3cd..c188c10cd 100644 --- a/src/Nix/Expr/Types.hs +++ b/src/Nix/Expr/Types.hs @@ -399,13 +399,13 @@ $(deriveOrd1 ''Binding) $(makeTraversals ''Binding) --- ** @NRecordType@ +-- ** @Recursivity@ --- | 'NRecordType' distinguishes between recursive and non-recursive attribute +-- | Distinguishes between recursive and non-recursive. Mainly for attribute -- sets. -data NRecordType - = NNonRecursive -- ^ > { ... } - | NRecursive -- ^ > rec { ... } +data Recursivity + = NonRecursive -- ^ > { ... } + | Recursive -- ^ > rec { ... } deriving ( Eq, Ord, Enum, Bounded, Generic , Typeable, Data, NFData, Serialise, Binary, ToJSON, FromJSON @@ -483,11 +483,11 @@ data NExprF r -- ^ A list literal. -- -- > NList [x,y] ~ [ x y ] - | NSet !NRecordType ![Binding r] + | NSet !Recursivity ![Binding r] -- ^ An attribute set literal -- - -- > NSet NRecursive [NamedVar x y _] ~ rec { x = y; } - -- > NSet NNonRecursive [Inherit Nothing [x] _] ~ { inherit x; } + -- > NSet Recursive [NamedVar x y _] ~ rec { x = y; } + -- > NSet NonRecursive [Inherit Nothing [x] _] ~ { inherit x; } | NLiteralPath !FilePath -- ^ A path expression, which is evaluated to a store path. The path here -- can be relative, in which case it's evaluated relative to the file in @@ -652,7 +652,7 @@ ekey => NonEmpty Text -> SourcePos -> Lens' (Fix g) (Maybe (Fix g)) -ekey keys pos f e@(Fix x) | (NSet NNonRecursive xs, ann) <- fromNExpr x = +ekey keys pos f e@(Fix x) | (NSet NonRecursive xs, ann) <- fromNExpr x = case go xs of ((v, [] ) : _) -> fromMaybe e <$> f (pure v) ((v, r : rest) : _) -> ekey (r :| rest) pos f v @@ -662,7 +662,7 @@ ekey keys pos f e@(Fix x) | (NSet NNonRecursive xs, ann) <- fromNExpr x = e (\ v -> let entry = NamedVar (StaticKey <$> keys) v pos in - Fix $ toNExpr ( NSet NNonRecursive $ [entry] <> xs, ann ) + Fix $ toNExpr ( NSet NonRecursive $ [entry] <> xs, ann ) ) <$> f Nothing diff --git a/src/Nix/Expr/Types/Annotated.hs b/src/Nix/Expr/Types/Annotated.hs index 4d8155b3d..aabfac0c3 100644 --- a/src/Nix/Expr/Types/Annotated.hs +++ b/src/Nix/Expr/Types/Annotated.hs @@ -206,7 +206,7 @@ pattern NSym_ ann x = AnnFP ann (NSym x) pattern NList_ :: SrcSpan -> [r] -> NExprLocF r pattern NList_ ann x = AnnFP ann (NList x) -pattern NSet_ :: SrcSpan -> NRecordType -> [Binding r] -> NExprLocF r +pattern NSet_ :: SrcSpan -> Recursivity -> [Binding r] -> NExprLocF r pattern NSet_ ann recur x = AnnFP ann (NSet recur x) pattern NLiteralPath_ :: SrcSpan -> FilePath -> NExprLocF r diff --git a/src/Nix/Parser.hs b/src/Nix/Parser.hs index f4d958cb8..6184bc572 100644 --- a/src/Nix/Parser.hs +++ b/src/Nix/Parser.hs @@ -265,7 +265,7 @@ nixLet = annotateLocation1 -- Let expressions `let {..., body = ...}' are just desugared -- into `(rec {..., body = ...}).body'. letBody = (\x -> NSelect x (StaticKey "body" :| mempty) Nothing) <$> aset - aset = annotateLocation1 $ NSet NRecursive <$> braces nixBinders + aset = annotateLocation1 $ NSet Recursive <$> braces nixBinders nixIf :: Parser NExprLoc nixIf = annotateLocation1 @@ -472,7 +472,7 @@ keyName = dynamicKey <+> staticKey nixSet :: Parser NExprLoc nixSet = annotateLocation1 ((isRec <*> braces nixBinders) "set") where - isRec = (reserved "rec" $> NSet NRecursive "recursive set") <+> pure (NSet NNonRecursive) + isRec = (reserved "rec" $> NSet Recursive "recursive set") <+> pure (NSet NonRecursive) parseNixFile :: MonadFile m => FilePath -> m (Result NExpr) parseNixFile = diff --git a/src/Nix/Pretty.hs b/src/Nix/Pretty.hs index 5d28002e7..add2aa43c 100644 --- a/src/Nix/Pretty.hs +++ b/src/Nix/Pretty.hs @@ -212,9 +212,9 @@ exprFNixDoc = \case NStr str -> simpleExpr $ prettyString str NList xs -> prettyContainer "[" (wrapParens appOpNonAssoc) "]" xs - NSet NNonRecursive xs -> + NSet NonRecursive xs -> prettyContainer "{" prettyBind "}" xs - NSet NRecursive xs -> + NSet Recursive xs -> prettyContainer "rec {" prettyBind "}" xs NAbs args body -> leastPrecedence $ @@ -318,7 +318,7 @@ valueToExpr = iterNValueByDiscardWith thk (Fix . phi) phi (NVConstant' a ) = NConstant a phi (NVStr' ns ) = NStr $ DoubleQuoted [Plain (stringIgnoreContext ns)] phi (NVList' l ) = NList l - phi (NVSet' s p) = NSet NNonRecursive + phi (NVSet' s p) = NSet NonRecursive [ NamedVar (StaticKey k :| mempty) v (fromMaybe nullPos (M.lookup k p)) | (k, v) <- toList s ] diff --git a/src/Nix/Reduce.hs b/src/Nix/Reduce.hs index b9e226d3b..d718785be 100644 --- a/src/Nix/Reduce.hs +++ b/src/Nix/Reduce.hs @@ -220,7 +220,7 @@ reduce base@(NSelect_ _ _ attrs _) n@(NamedVar (a' :| _) _ _) | a' == a -> pure n _ -> findBind xs attrs -- Follow the attrpath recursively in sets. - inspectSet (NSet_ _ NNonRecursive binds) attrs = case findBind binds attrs of + inspectSet (NSet_ _ NonRecursive binds) attrs = case findBind binds attrs of Just (NamedVar _ e _) -> case NE.uncons attrs of (_, Just attrs) -> inspectSet (unFix e) attrs _ -> pure e @@ -231,7 +231,7 @@ reduce base@(NSelect_ _ _ attrs _) -- | Reduce a set by inlining its binds outside of the set -- if none of the binds inherit the super set. -reduce e@(NSet_ ann NNonRecursive binds) = +reduce e@(NSet_ ann NonRecursive binds) = do let usesInherit = @@ -244,13 +244,13 @@ reduce e@(NSet_ ann NNonRecursive binds) = bool (Fix <$> sequence e) - (clearScopes @NExprLoc $ Fix . NSet_ ann NNonRecursive <$> traverse sequence binds) + (clearScopes @NExprLoc $ Fix . NSet_ ann NonRecursive <$> traverse sequence binds) usesInherit -- Encountering a 'rec set' construction eliminates any hope of inlining -- definitions. -reduce (NSet_ ann NRecursive binds) = - clearScopes @NExprLoc $ Fix . NSet_ ann NRecursive <$> traverse sequence binds +reduce (NSet_ ann Recursive binds) = + clearScopes @NExprLoc $ Fix . NSet_ ann Recursive <$> traverse sequence binds -- Encountering a 'with' construction eliminates any hope of inlining -- definitions. diff --git a/src/Nix/TH.hs b/src/Nix/TH.hs index 243716ce1..526465219 100644 --- a/src/Nix/TH.hs +++ b/src/Nix/TH.hs @@ -17,38 +17,51 @@ import Nix.Parser quoteExprExp :: String -> ExpQ quoteExprExp s = do - expr <- - either - (fail . show) - pure - (parseNixText $ toText s) + expr <- parseExpr s dataToExpQ - (const Nothing `extQ` metaExp (freeVars expr) `extQ` (pure . (TH.lift :: Text -> Q Exp))) + (extQOnFreeVars metaExp expr `extQ` (pure . (TH.lift :: Text -> Q Exp))) expr quoteExprPat :: String -> PatQ quoteExprPat s = do - expr <- - either - (fail . show) - pure - (parseNixText $ toText s) + expr <- parseExpr s dataToPatQ - (const Nothing `extQ` metaPat (freeVars expr)) + (extQOnFreeVars metaPat expr) expr +-- | Helper function. +extQOnFreeVars + :: ( Typeable b + , Typeable loc + ) + => ( Set VarName + -> loc + -> Maybe q + ) + -> NExpr + -> b + -> Maybe q +extQOnFreeVars f e = extQ (const Nothing) (f $ freeVars e) + +parseExpr :: (MonadFail m, ToText a) => a -> m NExpr +parseExpr s = + either + (fail . show) + pure + (parseNixText $ toText s) + freeVars :: NExpr -> Set VarName freeVars e = case unFix e of (NConstant _ ) -> mempty (NStr string ) -> mapFreeVars string (NSym var ) -> one var (NList list ) -> mapFreeVars list - (NSet NNonRecursive bindings) -> bindFreeVars bindings - (NSet NRecursive bindings) -> Set.difference (bindFreeVars bindings) (bindDefs bindings) + (NSet NonRecursive bindings) -> bindFreeVars bindings + (NSet Recursive bindings) -> diffBetween bindFreeVars bindDefs bindings (NLiteralPath _ ) -> mempty (NEnvPath _ ) -> mempty (NUnary _ expr ) -> freeVars expr - (NBinary _ left right ) -> ((<>) `on` freeVars) left right + (NBinary _ left right ) -> collectFreeVars left right (NSelect expr path orExpr) -> Set.unions [ freeVars expr @@ -69,18 +82,22 @@ freeVars e = case unFix e of ) (NLet bindings expr ) -> freeVars expr <> - Set.difference - (bindFreeVars bindings) - (bindDefs bindings) + diffBetween bindFreeVars bindDefs bindings (NIf cond th el ) -> Set.unions $ freeVars <$> [cond, th, el] -- Evaluation is needed to find out whether x is a "real" free variable in `with y; x`, we just include it -- This also makes sense because its value can be overridden by `x: with y; x` - (NWith set expr ) -> ((<>) `on` freeVars) set expr - (NAssert assertion expr ) -> ((<>) `on` freeVars) assertion expr + (NWith set expr ) -> collectFreeVars set expr + (NAssert assertion expr ) -> collectFreeVars assertion expr (NSynHole _ ) -> mempty where + diffBetween :: (a -> Set VarName) -> (a -> Set VarName) -> a -> Set VarName + diffBetween g f b = Set.difference (g b) (f b) + + collectFreeVars :: NExpr -> NExpr -> Set VarName + collectFreeVars = (<>) `on` freeVars + bindDefs :: Foldable t => t (Binding NExpr) -> Set VarName bindDefs = foldMap bind1Def where diff --git a/tests/NixLanguageTests.hs b/tests/NixLanguageTests.hs index 3c974318a..847ce82d3 100644 --- a/tests/NixLanguageTests.hs +++ b/tests/NixLanguageTests.hs @@ -77,14 +77,14 @@ genTests = do <$> globDir1 (compile "*-*-*.*") "data/nix/tests/lang" let testsByName = groupBy (takeFileName . dropExtensions) testFiles let testsByType = groupBy testType (Map.toList testsByName) - let testGroups = fmap mkTestGroup (Map.toList testsByType) + let testGroups = mkTestGroup <$> Map.toList testsByType pure $ localOption (mkTimeout 2000000) $ testGroup "Nix (upstream) language tests" testGroups where testType (fullpath, _files) = take 2 $ splitOn "-" $ takeFileName fullpath mkTestGroup (kind, tests) = - testGroup (String.unwords kind) $ fmap (mkTestCase kind) tests + testGroup (String.unwords kind) $ mkTestCase kind <$> tests mkTestCase kind (basename, files) = testCase (takeFileName basename) $ do time <- liftIO getCurrentTime let opts = defaultOptions time diff --git a/tests/ParserTests.hs b/tests/ParserTests.hs index 572099954..67c2ea5cd 100644 --- a/tests/ParserTests.hs +++ b/tests/ParserTests.hs @@ -69,51 +69,51 @@ case_constant_uri = do assertParseFail "+:acdcd" case_simple_set = do - assertParseText "{ a = 23; b = 4; }" $ Fix $ NSet NNonRecursive + assertParseText "{ a = 23; b = 4; }" $ Fix $ NSet NonRecursive [ NamedVar (mkSelector "a") (mkInt 23) nullPos , NamedVar (mkSelector "b") (mkInt 4) nullPos ] assertParseFail "{ a = 23 }" case_set_inherit = do - assertParseText "{ e = 3; inherit a b; }" $ Fix $ NSet NNonRecursive + assertParseText "{ e = 3; inherit a b; }" $ Fix $ NSet NonRecursive [ NamedVar (mkSelector "e") (mkInt 3) nullPos , Inherit Nothing (StaticKey <$> ["a", "b"]) nullPos ] - assertParseText "{ inherit; }" $ Fix $ NSet NNonRecursive [ Inherit Nothing mempty nullPos ] + assertParseText "{ inherit; }" $ Fix $ NSet NonRecursive [ Inherit Nothing mempty nullPos ] -case_set_scoped_inherit = assertParseText "{ inherit (a) b c; e = 4; inherit(a)b c; }" $ Fix $ NSet NNonRecursive +case_set_scoped_inherit = assertParseText "{ inherit (a) b c; e = 4; inherit(a)b c; }" $ Fix $ NSet NonRecursive [ Inherit (pure (mkSym "a")) (StaticKey <$> ["b", "c"]) nullPos , NamedVar (mkSelector "e") (mkInt 4) nullPos , Inherit (pure (mkSym "a")) (StaticKey <$> ["b", "c"]) nullPos ] -case_set_rec = assertParseText "rec { a = 3; b = a; }" $ Fix $ NSet NRecursive +case_set_rec = assertParseText "rec { a = 3; b = a; }" $ Fix $ NSet Recursive [ NamedVar (mkSelector "a") (mkInt 3) nullPos , NamedVar (mkSelector "b") (mkSym "a") nullPos ] case_set_complex_keynames = do - assertParseText "{ \"\" = null; }" $ Fix $ NSet NNonRecursive + assertParseText "{ \"\" = null; }" $ Fix $ NSet NonRecursive [ NamedVar (DynamicKey (Plain (DoubleQuoted mempty)) :| mempty) mkNull nullPos ] - assertParseText "{ a.b = 3; a.c = 4; }" $ Fix $ NSet NNonRecursive + assertParseText "{ a.b = 3; a.c = 4; }" $ Fix $ NSet NonRecursive [ NamedVar (StaticKey "a" :| [StaticKey "b"]) (mkInt 3) nullPos , NamedVar (StaticKey "a" :| [StaticKey "c"]) (mkInt 4) nullPos ] - assertParseText "{ ${let a = \"b\"; in a} = 4; }" $ Fix $ NSet NNonRecursive + assertParseText "{ ${let a = \"b\"; in a} = 4; }" $ Fix $ NSet NonRecursive [ NamedVar (DynamicKey (Antiquoted letExpr) :| mempty) (mkInt 4) nullPos ] - assertParseText "{ \"a${let a = \"b\"; in a}c\".e = 4; }" $ Fix $ NSet NNonRecursive + assertParseText "{ \"a${let a = \"b\"; in a}c\".e = 4; }" $ Fix $ NSet NonRecursive [ NamedVar (DynamicKey (Plain str) :| [StaticKey "e"]) (mkInt 4) nullPos ] where letExpr = Fix $ NLet [NamedVar (mkSelector "a") (mkStr "b") nullPos] (mkSym "a") str = DoubleQuoted [Plain "a", Antiquoted letExpr, Plain "c"] -case_set_inherit_direct = assertParseText "{ inherit ({a = 3;}); }" $ Fix $ NSet NNonRecursive - [ Inherit (pure $ Fix $ NSet NNonRecursive [NamedVar (mkSelector "a") (mkInt 3) nullPos]) mempty nullPos +case_set_inherit_direct = assertParseText "{ inherit ({a = 3;}); }" $ Fix $ NSet NonRecursive + [ Inherit (pure $ Fix $ NSet NonRecursive [NamedVar (mkSelector "a") (mkInt 3) nullPos]) mempty nullPos ] case_inherit_selector = do - assertParseText "{ inherit \"a\"; }" $ Fix $ NSet NNonRecursive + assertParseText "{ inherit \"a\"; }" $ Fix $ NSet NonRecursive [Inherit Nothing [DynamicKey (Plain (DoubleQuoted [Plain "a"]))] nullPos] assertParseFail "{ inherit a.x; }" @@ -124,7 +124,7 @@ case_int_null_list = assertParseText "[1 2 3 null 4]" $ Fix (NList (fmap (Fix . case_mixed_list = do assertParseText "[{a = 3;}.a (if true then null else false) null false 4 [] c.d or null]" $ Fix $ NList - [ Fix (NSelect (Fix (NSet NNonRecursive [NamedVar (mkSelector "a") (mkInt 3) nullPos])) + [ Fix (NSelect (Fix (NSet NonRecursive [NamedVar (mkSelector "a") (mkInt 3) nullPos])) (mkSelector "a") Nothing) , Fix (NIf (mkBool True) mkNull (mkBool False)) , mkNull, mkBool False, mkInt 4, Fix (NList mempty) @@ -141,7 +141,7 @@ case_lambda_or_uri = do assertParseText "a :b" $ Fix $ NAbs (Param "a") (mkSym "b") assertParseText "a c:def" $ Fix $ NBinary NApp (mkSym "a") (mkStr "c:def") assertParseText "c:def: c" $ Fix $ NBinary NApp (mkStr "c:def:") (mkSym "c") - assertParseText "a:{}" $ Fix $ NAbs (Param "a") $ Fix $ NSet NNonRecursive mempty + assertParseText "a:{}" $ Fix $ NAbs (Param "a") $ Fix $ NSet NonRecursive mempty assertParseText "a:[a]" $ Fix $ NAbs (Param "a") $ Fix $ NList [mkSym "a"] assertParseFail "def:" @@ -182,7 +182,7 @@ case_simple_let = do case_let_body = assertParseText "let { body = 1; }" letBody where letBody = Fix $ NSelect aset (mkSelector "body") Nothing - aset = Fix $ NSet NRecursive [NamedVar (mkSelector "body") (mkInt 1) nullPos] + aset = Fix $ NSet Recursive [NamedVar (mkSelector "body") (mkInt 1) nullPos] case_nested_let = do assertParseText "let a = 4; in let b = 5; in a" $ Fix $ NLet @@ -253,11 +253,11 @@ case_select = do assertParseText "a.e . d or null" $ Fix $ NSelect (mkSym "a") (StaticKey "e" :| [StaticKey "d"]) (pure mkNull) - assertParseText "{}.\"\"or null" $ Fix $ NSelect (Fix (NSet NNonRecursive mempty)) + assertParseText "{}.\"\"or null" $ Fix $ NSelect (Fix (NSet NonRecursive mempty)) (DynamicKey (Plain (DoubleQuoted mempty)) :| mempty) (pure mkNull) assertParseText "{ a = [1]; }.a or [2] ++ [3]" $ Fix $ NBinary NConcat (Fix (NSelect - (Fix (NSet NNonRecursive [NamedVar (StaticKey "a" :| mempty) + (Fix (NSet NonRecursive [NamedVar (StaticKey "a" :| mempty) (Fix (NList [Fix (NConstant (NInt 1))])) nullPos])) (StaticKey "a" :| mempty) @@ -267,14 +267,14 @@ case_select = do case_select_path = do assertParseText "f ./." $ Fix $ NBinary NApp (mkSym "f") (mkPath False "./.") assertParseText "f.b ../a" $ Fix $ NBinary NApp select (mkPath False "../a") - assertParseText "{}./def" $ Fix $ NBinary NApp (Fix (NSet NNonRecursive mempty)) (mkPath False "./def") + assertParseText "{}./def" $ Fix $ NBinary NApp (Fix (NSet NonRecursive mempty)) (mkPath False "./def") assertParseText "{}.\"\"./def" $ Fix $ NBinary NApp - (Fix $ NSelect (Fix (NSet NNonRecursive mempty)) (DynamicKey (Plain (DoubleQuoted mempty)) :| mempty) Nothing) + (Fix $ NSelect (Fix (NSet NonRecursive mempty)) (DynamicKey (Plain (DoubleQuoted mempty)) :| mempty) Nothing) (mkPath False "./def") where select = Fix $ NSelect (mkSym "f") (mkSelector "b") Nothing case_select_keyword = do - assertParseText "{ false = \"foo\"; }" $ Fix $ NSet NNonRecursive [NamedVar (mkSelector "false") (mkStr "foo") nullPos] + assertParseText "{ false = \"foo\"; }" $ Fix $ NSet NonRecursive [NamedVar (mkSelector "false") (mkStr "foo") nullPos] case_fun_app = do assertParseText "f a b" $ Fix $ NBinary NApp (Fix $ NBinary NApp (mkSym "f") (mkSym "a")) (mkSym "b") @@ -311,8 +311,8 @@ case_operators = do assertParseText "1 + (if true then 2 else 3)" $ mkOper2 NPlus (mkInt 1) $ Fix $ NIf (mkBool True) (mkInt 2) (mkInt 3) assertParseText "{ a = 3; } // rec { b = 4; }" $ mkOper2 NUpdate - (Fix $ NSet NNonRecursive [NamedVar (mkSelector "a") (mkInt 3) nullPos]) - (Fix $ NSet NRecursive [NamedVar (mkSelector "b") (mkInt 4) nullPos]) + (Fix $ NSet NonRecursive [NamedVar (mkSelector "a") (mkInt 3) nullPos]) + (Fix $ NSet Recursive [NamedVar (mkSelector "b") (mkInt 4) nullPos]) assertParseText "--a" $ mkOper NNeg $ mkOper NNeg $ mkSym "a" assertParseText "a - b - c" $ mkOper2 NMinus (mkOper2 NMinus (mkSym "a") (mkSym "b")) $ diff --git a/tests/PrettyParseTests.hs b/tests/PrettyParseTests.hs index 66867160a..3a5a6e140 100644 --- a/tests/PrettyParseTests.hs +++ b/tests/PrettyParseTests.hs @@ -129,8 +129,8 @@ genExpr = Gen.sized $ \(Size n) -> Fix <$> if n < 2 genStr = NStr <$> genString genSym = NSym <$> asciiText genList = NList <$> fairList genExpr - genSet = NSet NNonRecursive <$> fairList genBinding - genRecSet = NSet NRecursive <$> fairList genBinding + genSet = NSet NonRecursive <$> fairList genBinding + genRecSet = NSet Recursive <$> fairList genBinding genLiteralPath = NLiteralPath . ("./" <>) <$> asciiString genEnvPath = NEnvPath <$> asciiString genUnary = liftA2 NUnary Gen.enumBounded genExpr