@@ -243,33 +243,19 @@ instance FromJSON SingleDerivedPath where
243243instance ToJSON DerivedPath where
244244 toJSON (DerivedPath_Opaque path) = toJSON path
245245 toJSON (DerivedPath_Built drvPath outputs) =
246- case outputs of
247- OutputsSpec_Names names | Data.Set. size names == 1 ->
248- object
249- [ " drvPath" .= toJSON drvPath
250- , " output" .= Data.Set. elemAt 0 names
251- ]
252- _ ->
253- object
254- [ " drvPath" .= toJSON drvPath
255- , " outputs" .= outputs
256- ]
246+ object
247+ [ " drvPath" .= toJSON drvPath
248+ , " outputs" .= outputs
249+ ]
257250
258251instance FromJSON DerivedPath where
259252 parseJSON v = parseOpaque v <|> parseBuilt v
260253 where
261254 parseOpaque = fmap DerivedPath_Opaque . parseJSON
262- parseBuilt = withObject " DerivedPath_Built" $ \ obj -> do
263- drvPath <- obj .: " drvPath"
264- -- Try single output first, then multiple outputs
265- mOutput <- obj .:? " output"
266- mOutputs <- obj .:? " outputs"
267- case (mOutput, mOutputs) of
268- (Just output, Nothing ) ->
269- pure $ DerivedPath_Built drvPath (OutputsSpec_Names (Data.Set. singleton output))
270- (Nothing , Just outputs) ->
271- pure $ DerivedPath_Built drvPath outputs
272- _ -> fail " Expected either 'output' or 'outputs' field"
255+ parseBuilt = withObject " DerivedPath_Built" $ \ obj ->
256+ DerivedPath_Built
257+ <$> obj .: " drvPath"
258+ <*> obj .: " outputs"
273259
274260data LowerLeading
275261instance StringModifier LowerLeading where
0 commit comments