clean-up: parens
M main/Repl.hs M src/Nix/Builtins.hs M src/Nix/Cited.hs M src/Nix/Exec.hs M src/Nix/Expr/Types/Annotated.hs M src/Nix/Pretty.hs
This commit is contained in:
parent
ffc82fc97e
commit
c3f4d72dfd
|
@ -166,7 +166,7 @@ initState mIni = do
|
|||
where
|
||||
evalText :: (MonadNix e t f m) => Text -> m (NValue t f m)
|
||||
evalText expr = case parseNixTextLoc expr of
|
||||
Failure e -> error $ "Impossible happened: Unable to parse expression - '" ++ (Data.Text.unpack expr) ++ "' error was " ++ show e
|
||||
Failure e -> error $ "Impossible happened: Unable to parse expression - '" ++ Data.Text.unpack expr ++ "' error was " ++ show e
|
||||
Success e -> do
|
||||
value <- evalExprLoc e
|
||||
pure value
|
||||
|
@ -402,7 +402,7 @@ completeFunc reversedPrev word
|
|||
case Data.HashMap.Lazy.lookup f m of
|
||||
Nothing -> pure []
|
||||
Just e ->
|
||||
(demand e)
|
||||
demand e
|
||||
(\e' -> fmap (("." <> f) <>) <$> algebraicComplete fs e')
|
||||
|
||||
in case val of
|
||||
|
@ -459,7 +459,7 @@ helpOptions =
|
|||
<> Prettyprinter.line
|
||||
<> "Available options:"
|
||||
<> Prettyprinter.line
|
||||
<> (renderSetOptions helpSetOptions)
|
||||
<> renderSetOptions helpSetOptions
|
||||
)
|
||||
setConfig
|
||||
]
|
||||
|
|
|
@ -1378,7 +1378,7 @@ exec_ xs = do
|
|||
fetchurl
|
||||
:: forall e t f m . MonadNix e t f m => NValue t f m -> m (NValue t f m)
|
||||
fetchurl v = demand v $ \case
|
||||
NVSet s _ -> attrsetGet "url" s >>= demand ?? (go (M.lookup "sha256" s))
|
||||
NVSet s _ -> attrsetGet "url" s >>= demand ?? go (M.lookup "sha256" s)
|
||||
v@NVStr{} -> go Nothing v
|
||||
v ->
|
||||
throwError
|
||||
|
|
|
@ -55,7 +55,7 @@ class HasCitations m v a where
|
|||
|
||||
instance HasCitations m v (NCited m v a) where
|
||||
citations = _provenance
|
||||
addProvenance x (NCited p v) = (NCited (x : p) v)
|
||||
addProvenance x (NCited p v) = NCited (x : p) v
|
||||
|
||||
class HasCitations1 m v f where
|
||||
citations1 :: f a -> [Provenance m v]
|
||||
|
|
|
@ -408,7 +408,7 @@ execBinaryOpForced scope span op lval rval = case op of
|
|||
(\rs2 -> nvStrP prov (ls `principledStringMappend` rs2))
|
||||
<$> coerceToString callFunc CopyToStore CoerceStringy rs
|
||||
(NVPath ls, NVStr rs) -> case principledGetStringNoContext rs of
|
||||
Just rs2 -> nvPathP prov <$> makeAbsolutePath @t @f (ls `mappend` (Text.unpack rs2))
|
||||
Just rs2 -> nvPathP prov <$> makeAbsolutePath @t @f (ls `mappend` Text.unpack rs2)
|
||||
Nothing -> throwError $ ErrorCall $
|
||||
-- data/nix/src/libexpr/eval.cc:1412
|
||||
"A string that refers to a store path cannot be appended to a path."
|
||||
|
@ -431,7 +431,7 @@ execBinaryOpForced scope span op lval rval = case op of
|
|||
|
||||
where
|
||||
prov :: Provenance m (NValue t f m)
|
||||
prov = (Provenance scope (NBinary_ span op (Just lval) (Just rval)))
|
||||
prov = Provenance scope (NBinary_ span op (Just lval) (Just rval))
|
||||
|
||||
toBool = pure . nvConstantP prov . NBool
|
||||
compare :: (forall a. Ord a => a -> a -> Bool) -> m (NValue t f m)
|
||||
|
|
|
@ -147,7 +147,7 @@ nSelectLoc
|
|||
:: NExprLoc -> Ann SrcSpan (NAttrPath NExprLoc) -> Maybe NExprLoc -> NExprLoc
|
||||
nSelectLoc e1@(AnnE s1 _) (Ann s2 ats) d = case d of
|
||||
Nothing -> AnnE (s1 <> s2) (NSelect e1 ats Nothing)
|
||||
Just (e2@(AnnE s3 _)) -> AnnE (s1 <> s2 <> s3) (NSelect e1 ats (Just e2))
|
||||
Just e2@(AnnE s3 _) -> AnnE (s1 <> s2 <> s3) (NSelect e1 ats (Just e2))
|
||||
_ -> error "nSelectLoc: unexpected"
|
||||
nSelectLoc _ _ _ = error "nSelectLoc: unexpected"
|
||||
|
||||
|
|
|
@ -409,8 +409,8 @@ printNix = iterNValue (\_ _ -> thk) phi
|
|||
where
|
||||
check v = fromMaybe
|
||||
v
|
||||
( (fmap (surround . show) (readMaybe v :: Maybe Int))
|
||||
<|> (fmap (surround . show) (readMaybe v :: Maybe Float))
|
||||
( fmap (surround . show) (readMaybe v :: Maybe Int)
|
||||
<|> fmap (surround . show) (readMaybe v :: Maybe Float)
|
||||
)
|
||||
where surround s = "\"" ++ s ++ "\""
|
||||
phi NVClosure'{} = "<<lambda>>"
|
||||
|
|
Loading…
Reference in New Issue