Skip to content

Commit 5d88582

Browse files
committed
cabalProject': Consider cabalProjectLocal even if cabalProject argument is null
1 parent 7480986 commit 5d88582

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lib/call-cabal-project-to-nix.nix

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,13 @@ let
126126
# access to the store is restricted. If origSrc was already in the store
127127
# you can pass the project in as a string.
128128
rawCabalProject =
129-
if cabalProject != null
130-
then cabalProject + (
131-
if cabalProjectLocal != null
132-
then ''
133-
134-
-- Added from cabalProjectLocal argument to cabalProject
135-
${cabalProjectLocal}
136-
''
137-
else ""
138-
)
139-
else null;
129+
if cabalProject == null && cabalProjectLocal == null
130+
then null
131+
else (
132+
# like fmap
133+
let f = g: x: if x == null then "" else g x; in
134+
f (x: x) cabalProject + f (x: "\n-- Added from cabalProjectLocal argument to cabalProject\n${x}") cabalProjectLocal
135+
);
140136

141137
cabalProjectIndexState =
142138
if rawCabalProject != null

0 commit comments

Comments
 (0)