Skip to content

Commit 5d206d1

Browse files
committed
String: StringContext: rename accessors
1 parent c582b33 commit 5d206d1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Nix/String.hs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ import Nix.Expr.Types ( VarName(..)
4848
-- | A Nix 'StringContext' ...
4949
data StringContext =
5050
StringContext
51-
{ scFlavor :: !ContextFlavor
52-
, scPath :: !VarName
51+
{ getStringContextFlavor :: !ContextFlavor
52+
, getStringContextPath :: !VarName
5353
}
5454
deriving (Eq, Ord, Show, Generic)
5555

@@ -192,13 +192,13 @@ toStringContexts path = go
192192
mkLstCtxFor t c = one (mkCtxFor t) <> go c
193193

194194

195-
toNixLikeContextValue :: StringContext -> (VarName, NixLikeContextValue)
195+
toNixLikeContextValue :: StringContext -> (NixLikeContextValue, VarName)
196196
toNixLikeContextValue sc =
197-
( scPath sc
198-
, case scFlavor sc of
197+
( case getStringContextFlavor sc of
199198
DirectPath -> NixLikeContextValue True False mempty
200199
AllOutputs -> NixLikeContextValue False True mempty
201200
DerivationOutput t -> NixLikeContextValue False False $ one t
201+
, getStringContextPath sc
202202
)
203203

204204
toNixLikeContext :: S.HashSet StringContext -> NixLikeContext
@@ -211,8 +211,7 @@ toNixLikeContext stringContext =
211211
where
212212
fun :: (StringContext -> AttrSet NixLikeContextValue -> AttrSet NixLikeContextValue)
213213
fun sc hm =
214-
let (t, nlcv) = toNixLikeContextValue sc in
215-
M.insertWith (<>) t nlcv hm
214+
uncurry (M.insertWith (<>)) (swap $ toNixLikeContextValue sc) hm
216215

217216
-- | Add 'StringContext's into the resulting set.
218217
addStringContext

0 commit comments

Comments
 (0)