mirror of
https://github.com/nmattia/snack.git
synced 2024-09-21 00:29:37 +03:00
reduce re-computation
Nix is not smart enough to promote calculated thunks to constants between function invocations
This commit is contained in:
parent
13c120327c
commit
153673db9e
@ -13,14 +13,14 @@ let
|
|||||||
# that file only)
|
# that file only)
|
||||||
singleOut = base: file:
|
singleOut = base: file:
|
||||||
let
|
let
|
||||||
|
basePrefix = (builtins.toString base) + "/";
|
||||||
pred = file: path: type:
|
pred = file: path: type:
|
||||||
let
|
let
|
||||||
topLevel = (builtins.toString base) + "/";
|
actual = (pkgs.lib.strings.removePrefix basePrefix path);
|
||||||
actual = (pkgs.lib.strings.removePrefix topLevel path);
|
|
||||||
expected = file;
|
expected = file;
|
||||||
in
|
in
|
||||||
(expected == actual) ||
|
(expected == actual) ||
|
||||||
(type == "directory" && (pkgs.lib.strings.hasPrefix actual expected));
|
(type == "directory" && (pkgs.lib.strings.hasPrefix actual expected));
|
||||||
mod = fileToModule file;
|
mod = fileToModule file;
|
||||||
# TODO: even though we're doing a lot of cleaning, there's sitll some
|
# TODO: even though we're doing a lot of cleaning, there's sitll some
|
||||||
# 'does-file-exist' happening
|
# 'does-file-exist' happening
|
||||||
|
Loading…
Reference in New Issue
Block a user