mirror of
https://github.com/github/semantic.git
synced 2024-12-18 20:31:55 +03:00
Use Applicative to tidy up further.
This commit is contained in:
parent
fecb0d8f1f
commit
41f38b1c59
@ -102,10 +102,9 @@ noLanguageForBlob blobPath = throwError (SomeException (NoLanguageForBlob blobPa
|
||||
type BlobPair = Edit Blob Blob
|
||||
|
||||
instance FromJSON BlobPair where
|
||||
parseJSON = withObject "BlobPair" $ \o -> do
|
||||
before <- o .:? "before"
|
||||
after <- o .:? "after"
|
||||
maybeM (Prelude.fail "Expected object with 'before' and/or 'after' keys only") (fromMaybes before after)
|
||||
parseJSON = withObject "BlobPair" $ \o ->
|
||||
fromMaybes <$> (o .:? "before") <*> (o .:? "after")
|
||||
>>= maybeM (Prelude.fail "Expected object with 'before' and/or 'after' keys only")
|
||||
|
||||
maybeBlobPair :: MonadFail m => Maybe Blob -> Maybe Blob -> m BlobPair
|
||||
maybeBlobPair a b = case (a, b) of
|
||||
|
Loading…
Reference in New Issue
Block a user