Skip to content

Commit 884df98

Browse files
committed
Builtins: add doc on Nix import clause
1 parent d9db2f8 commit 884df98

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Nix/Builtins.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,16 @@ throwNix mnv =
12021202

12031203
throwError . ErrorCall . toString $ stringIgnoreContext ns
12041204

1205+
-- | Implementation of Nix @import@ clause.
1206+
--
1207+
-- Because Nix @import@s work strictly
1208+
-- (import gets fully evaluated befor bringing it into the scope it was called from)
1209+
-- - that property raises a requirement for execution phase of the interpreter go into evaluation phase
1210+
-- & then also go into parsing phase on the imports.
1211+
-- So it is not possible (more precise - not practical) to do a full parse Nix code phase fully & then go into evaluation phase.
1212+
-- As it is not possible to "import them lazily", as import is strict & it is not possible to establish
1213+
-- what imports whould be needed up until where it would be determined & they import strictly
1214+
--
12051215
importNix
12061216
:: forall e t f m . MonadNix e t f m => NValue t f m -> m (NValue t f m)
12071217
importNix = scopedImportNix $ nvSet mempty mempty

src/Nix/Convert.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ instance Convertible e t f m
211211
=> FromValue ByteString m (NValue' t f m (NValue t f m)) where
212212

213213
fromValueMay =
214-
pure.
214+
pure .
215215
\case
216216
NVStr' ns -> encodeUtf8 <$> getStringNoContext ns
217217
_ -> mempty

0 commit comments

Comments
 (0)