@@ -364,40 +364,45 @@ module Database.V5.Bloodhound.Types
364364 , EsPassword(..)
365365 ) where
366366
367−import Control.Applicative as A
368−import Control.Arrow (first)
367+import Control.Applicative as A
368+import Control.Arrow (first)
369369import Control.Monad.Catch
370370import Control.Monad.Except
371−import Control.Monad.Reader
372−import Control.Monad.State
373−import Control.Monad.Writer
371+import Control.Monad.Reader (MonadReader (..),
372+ ReaderT (..))
373+import Control.Monad.State (MonadState)
374+import Control.Monad.Writer (MonadWriter)
374375import Data.Aeson
375−import Data.Aeson.Types (Pair, Parser, emptyObject,
376− parseEither, parseMaybe)
377−import qualified Data.ByteString.Lazy.Char8 as L
376+import Data.Aeson.Types (Pair, Parser,
377+ emptyObject,
378+ parseEither, parseMaybe)
379+import qualified Data.ByteString.Lazy.Char8 as L
378380import Data.Char
379−import Data.Hashable (Hashable)
380−import qualified Data.HashMap.Strict as HM
381−import Data.List (foldl', intercalate, nub)
382−import Data.List.NonEmpty (NonEmpty (..), toList)
383−import qualified Data.Map.Strict as M
381+import Data.Hashable (Hashable)
382+import qualified Data.HashMap.Strict as HM
383+import Data.List (foldl', intercalate,
384+ nub)
385+import Data.List.NonEmpty (NonEmpty (..), toList)
386+import qualified Data.Map.Strict as M
384387import Data.Maybe
385−import Data.Scientific (Scientific)
386−import Data.Text (Text)
387−import qualified Data.Text as T
388+import Data.Scientific (Scientific)
389+import Data.Semigroup
390+import Data.Text (Text)
391+import qualified Data.Text as T
388392import Data.Time.Calendar
389−import Data.Time.Clock (NominalDiffTime, UTCTime)
393+import Data.Time.Clock (NominalDiffTime,
394+ UTCTime)
390395import Data.Time.Clock.POSIX
391−import qualified Data.Traversable as DT
392−import Data.Typeable (Typeable)
393−import qualified Data.Vector as V
394−import qualified Data.Version as Vers
396+import qualified Data.Traversable as DT
397+import Data.Typeable (Typeable)
398+import qualified Data.Vector as V
399+import qualified Data.Version as Vers
395400import GHC.Enum
396−import GHC.Generics (Generic)
401+import GHC.Generics (Generic)
397402import Network.HTTP.Client
398−import qualified Network.HTTP.Types.Method as NHTM
399−import qualified Text.ParserCombinators.ReadP as RP
400−import qualified Text.Read as TR
403+import qualified Network.HTTP.Types.Method as NHTM
404+import qualified Text.ParserCombinators.ReadP as RP
405+import qualified Text.Read as TR
401406
402407import Database.V5.Bloodhound.Types.Class
403408import Database.V5.Bloodhound.Types.Internal
@@ -452,11 +457,11 @@ runBH :: BHEnv -> BH m a -> m a
452457runBH e f = runReaderT (unBH f) e
453458
454459{-| 'Version' is embedded in 'Status' -}
455−data Version = Version { number :: VersionNumber
456− , build_hash :: BuildHash
457− , build_date :: UTCTime
458− , build_snapshot :: Bool
459− , lucene_version :: VersionNumber } deriving (Eq, Read, Show, Generic, Typeable)
460+data Version = Version { number :: VersionNumber
461+ , build_hash :: BuildHash
462+ , build_date :: UTCTime
463+ , build_snapshot :: Bool
464+ , lucene_version :: VersionNumber } deriving (Eq, Read, Show, Generic, Typeable)
460465
461466-- | Traditional software versioning number
462467newtype VersionNumber = VersionNumber { versionNumber :: Vers.Version
@@ -494,7 +499,7 @@ defaultIndexSettings = IndexSettings (ShardCount 3) (ReplicaCount 2)
494499 for more info.
495500-}
496501data ForceMergeIndexSettings =
497− ForceMergeIndexSettings { maxNumSegments :: Maybe Int
502+ ForceMergeIndexSettings { maxNumSegments :: Maybe Int
498503 -- ^ Number of segments to optimize to. 1 will fully optimize the index. If omitted, the default behavior is to only optimize if the server deems it necessary.
499504 , onlyExpungeDeletes :: Bool
500505 -- ^ Should the optimize process only expunge segments with deletes in them? If the purpose of the optimization is to free disk space, this should be set to True.
@@ -847,8 +852,8 @@ data SortSpec = DefaultSortSpec DefaultSort
847852{-| 'DefaultSort' is usually the kind of 'SortSpec' you'll want. There's a
848853 'mkSort' convenience function for when you want to specify only the most
849854 common parameters.
850−
851− The `ignoreUnmapped`, when `Just` field is used to set the elastic 'unmapped_type'
855+
856+ The `ignoreUnmapped`, when `Just` field is used to set the elastic 'unmapped_type'
852857
853858<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#search-request-sort>
854859-}
@@ -1206,7 +1211,7 @@ data Query =
12061211 deriving (Eq, Read, Show, Generic, Typeable)
12071212
12081213-- | As of Elastic 2.0, 'Filters' are just 'Queries' housed in a Bool Query, and
1209−-- flagged in a different context.
1214+-- flagged in a different context.
12101215newtype Filter = Filter { unFilter :: Query }
12111216 deriving (Eq, Read, Show, Generic, Typeable)
12121217
@@ -1465,8 +1470,8 @@ data BoolQuery =
14651470 } deriving (Eq, Read, Show, Generic, Typeable)
14661471
14671472mkBoolQuery :: [Query] -> [Filter] -> [Query] -> [Query] -> BoolQuery
1468−mkBoolQuery must filter mustNot should =
1469− BoolQuery must filter mustNot should Nothing Nothing Nothing
1473+mkBoolQuery must filt mustNot should =
1474+ BoolQuery must filt mustNot should Nothing Nothing Nothing
14701475
14711476data BoostingQuery =
14721477 BoostingQuery { positiveQuery :: Query
@@ -1631,12 +1636,12 @@ data SearchHits a =
16311636 , maxScore :: Score
16321637 , hits :: [Hit a] } deriving (Eq, Read, Show, Generic, Typeable)
16331638
1639+instance Semigroup (SearchHits a) where
1640+ (SearchHits ta ma ha) <> (SearchHits tb mb hb) = SearchHits (ta + tb) (max ma mb) (ha <> hb)
16341641
16351642instance Monoid (SearchHits a) where
16361643 mempty = SearchHits 0 Nothing mempty
1637− mappend (SearchHits ta ma ha) (SearchHits tb mb hb) =
1638− SearchHits (ta + tb) (max ma mb) (ha <> hb)
1639−
1644+ mappend = (<>)
16401645
16411646data Hit a =
16421647 Hit { hitIndex :: IndexName
@@ -1659,7 +1664,7 @@ showText = T.pack . show
16591664readMay :: Read a => String -> Maybe a
16601665readMay s = case reads s of
16611666 (a, ""):_ -> Just a
1662− _ -> Nothing
1667+ _ -> Nothing
16631668
16641669parseReadText :: Read a => Text -> Parser a
16651670parseReadText = maybe mzero return . readMay . T.unpack
@@ -1708,8 +1713,8 @@ data Aggregation = TermsAgg TermsAggregation
17081713 | ValueCountAgg ValueCountAggregation
17091714 | FilterAgg FilterAggregation
17101715 | DateRangeAgg DateRangeAggregation
1711− | MissingAgg MissingAggregation
1712− | TopHitsAgg TopHitsAggregation
1716+ | MissingAgg MissingAggregation
1717+ | TopHitsAgg TopHitsAggregation
17131718 deriving (Eq, Read, Show, Generic, Typeable)
17141719
17151720data TopHitsAggregation = TopHitsAggregation
@@ -1846,21 +1851,21 @@ instance ToJSON ExecutionHint where
18461851 toJSON Map = "map"
18471852
18481853instance ToJSON Interval where
1849− toJSON Year = "year"
1854+ toJSON Year = "year"
18501855 toJSON Quarter = "quarter"
1851− toJSON Month = "month"
1852− toJSON Week = "week"
1853− toJSON Day = "day"
1854− toJSON Hour = "hour"
1855− toJSON Minute = "minute"
1856− toJSON Second = "second"
1856+ toJSON Month = "month"
1857+ toJSON Week = "week"
1858+ toJSON Day = "day"
1859+ toJSON Hour = "hour"
1860+ toJSON Minute = "minute"
1861+ toJSON Second = "second"
18571862
18581863instance Show TimeInterval where
1859− show Weeks = "w"
1860− show Days = "d"
1861− show Hours = "h"
1862− show Minutes = "m"
1863− show Seconds = "s"
1864+ show Weeks = "w"
1865+ show Days = "d"
1866+ show Hours = "h"
1867+ show Minutes = "m"
1868+ show Seconds = "s"
18641869
18651870instance Read TimeInterval where
18661871 readPrec = f =<< TR.get
@@ -1916,7 +1921,7 @@ instance ToJSON Aggregation where
19161921 toJSON (MissingAgg (MissingAggregation{..})) =
19171922 object ["missing" .= object ["field" .= maField]]
19181923
1919− toJSON (TopHitsAgg (TopHitsAggregation mfrom msize msort)) =
1924+ toJSON (TopHitsAgg (TopHitsAggregation mfrom msize msort)) =
19201925 omitNulls ["top_hits" .= omitNulls [ "size" .= msize
19211926 , "from" .= mfrom
19221927 , "sort" .= msort
@@ -1931,22 +1936,22 @@ instance ToJSON DateRangeAggregation where
19311936 ]
19321937
19331938instance ToJSON DateRangeAggRange where
1934− toJSON (DateRangeFrom e) = object [ "from" .= e ]
1935− toJSON (DateRangeTo e) = object [ "to" .= e ]
1939+ toJSON (DateRangeFrom e) = object [ "from" .= e ]
1940+ toJSON (DateRangeTo e) = object [ "to" .= e ]
19361941 toJSON (DateRangeFromAndTo f t) = object [ "from" .= f, "to" .= t ]
19371942
19381943instance ToJSON DateMathExpr where
19391944 toJSON (DateMathExpr a mods) = String (fmtA a <> mconcat (fmtMod <$> mods))
1940− where fmtA DMNow = "now"
1945+ where fmtA DMNow = "now"
19411946 fmtA (DMDate date) = (T.pack $ showGregorian date) <> "||"
1942− fmtMod (AddTime n u) = "+" <> showText n <> fmtU u
1947+ fmtMod (AddTime n u) = "+" <> showText n <> fmtU u
19431948 fmtMod (SubtractTime n u) = "-" <> showText n <> fmtU u
1944− fmtMod (RoundDownTo u) = "/" <> fmtU u
1945− fmtU DMYear = "y"
1946− fmtU DMMonth = "M"
1947− fmtU DMWeek = "w"
1948− fmtU DMDay = "d"
1949− fmtU DMHour = "h"
1949+ fmtMod (RoundDownTo u) = "/" <> fmtU u
1950+ fmtU DMYear = "y"
1951+ fmtU DMMonth = "M"
1952+ fmtU DMWeek = "w"
1953+ fmtU DMDay = "d"
1954+ fmtU DMHour = "h"
19501955 fmtU DMMinute = "m"
19511956 fmtU DMSecond = "s"
19521957
@@ -2026,8 +2031,8 @@ instance (FromJSON a, BucketAggregation a) => FromJSON (Bucket a) where
20262031instance FromJSON BucketValue where
20272032 parseJSON (String t) = return $ TextValue t
20282033 parseJSON (Number s) = return $ ScientificValue s
2029− parseJSON (Bool b) = return $ BoolValue b
2030− parseJSON _ = mempty
2034+ parseJSON (Bool b) = return $ BoolValue b
2035+ parseJSON _ = mempty
20312036
20322037instance FromJSON MissingResult where
20332038 parseJSON = withObject "MissingResult" parse
@@ -2086,11 +2091,11 @@ fieldTagged f o = case HM.toList o of
20862091 _ -> fail "Expected object with 1 field-named key"
20872092
20882093-- Try to get an AggregationResults when we don't know the
2089−-- field name. We filter out the known keys to try to minimize the noise.
2094+-- field name. We filter out the known keys to try to minimize the noise.
20902095getNamedSubAgg :: Object -> [Text] -> Maybe AggregationResults
20912096getNamedSubAgg o knownKeys = maggRes
20922097 where unknownKeys = HM.filterWithKey (\k _ -> k `notElem` knownKeys) o
2093− maggRes
2098+ maggRes
20942099 | HM.null unknownKeys = Nothing
20952100 | otherwise = Just . M.fromList $ HM.toList unknownKeys
20962101
@@ -2188,7 +2193,7 @@ instance ToJSON Query where
21882193 object ["exists" .= object
21892194 ["field" .= fieldName]
21902195 ]
2191− toJSON QueryMatchNoneQuery =
2196+ toJSON QueryMatchNoneQuery =
21922197 object ["match_none" .= object []]
21932198
21942199instance FromJSON Query where
@@ -2259,9 +2264,9 @@ instance FromJSON Query where
22592264
22602265omitNulls :: [(Text, Value)] -> Value
22612266omitNulls = object . filter notNull where
2262− notNull (_, Null) = False
2267+ notNull (_, Null) = False
22632268 notNull (_, Array a) = (not . V.null) a
2264− notNull _ = True
2269+ notNull _ = True
22652270
22662271instance ToJSON SimpleQueryStringQuery where
22672272 toJSON SimpleQueryStringQuery {..} =
@@ -2804,10 +2809,10 @@ instance FromJSON MultiMatchQuery where
28042809 <*> o .:? "lenient"
28052810
28062811instance ToJSON MultiMatchQueryType where
2807− toJSON MultiMatchBestFields = "best_fields"
2808− toJSON MultiMatchMostFields = "most_fields"
2809− toJSON MultiMatchCrossFields = "cross_fields"
2810− toJSON MultiMatchPhrase = "phrase"
2812+ toJSON MultiMatchBestFields = "best_fields"
2813+ toJSON MultiMatchMostFields = "most_fields"
2814+ toJSON MultiMatchCrossFields = "cross_fields"
2815+ toJSON MultiMatchPhrase = "phrase"
28112816 toJSON MultiMatchPhrasePrefix = "phrase_prefix"
28122817
28132818instance FromJSON MultiMatchQueryType where
@@ -2821,7 +2826,7 @@ instance FromJSON MultiMatchQueryType where
28212826
28222827instance ToJSON BooleanOperator where
28232828 toJSON And = String "and"
2824− toJSON Or = String "or"
2829+ toJSON Or = String "or"
28252830
28262831instance FromJSON BooleanOperator where
28272832 parseJSON = withText "BooleanOperator" parse
@@ -2840,7 +2845,7 @@ instance FromJSON ZeroTermsQuery where
28402845 parse q = fail ("Unexpected ZeroTermsQuery: " <> show q)
28412846
28422847instance ToJSON MatchQueryType where
2843− toJSON MatchPhrase = "phrase"
2848+ toJSON MatchPhrase = "phrase"
28442849 toJSON MatchPhrasePrefix = "phrase_prefix"
28452850
28462851instance FromJSON MatchQueryType where
@@ -2974,7 +2979,7 @@ instance FromJSON IndexSettingsSummary where
29742979 <*> (fmap (filter (not . redundant)) . parseSettings =<< o' .: "settings")
29752980 _ -> fail "Expected single-key object with index name"
29762981 redundant (NumberOfReplicas _) = True
2977− redundant _ = False
2982+ redundant _ = False
29782983
29792984-- | For some reason in several settings APIs, all leaf values get returned
29802985-- as strings. This function attepmts to recover from this for all
@@ -2984,7 +2989,7 @@ unStringlyTypeJSON (String "true") = Bool True
29842989unStringlyTypeJSON (String "false") = Bool False
29852990unStringlyTypeJSON (String "null") = Null
29862991unStringlyTypeJSON v@(String t) = case readMay (T.unpack t) of
2987− Just n -> Number n
2992+ Just n -> Number n
29882993 Nothing -> v
29892994unStringlyTypeJSON v = v
29902995
@@ -3001,7 +3006,7 @@ parseSettings o = do
30013006 return (catMaybes parses)
30023007
30033008oPath :: ToJSON a => NonEmpty Text -> a -> Value
3004−oPath (k :| []) v = object [k .= v]
3009+oPath (k :| []) v = object [k .= v]
30053010oPath (k:| (h:t)) v = object [k .= oPath (h :| t) v]
30063011
30073012attrFilterJSON :: NonEmpty NodeAttrFilter -> Value
@@ -3011,12 +3016,12 @@ attrFilterJSON fs = object [ n .= T.intercalate "," (toList vs)
30113016parseAttrFilter :: Value -> Parser (NonEmpty NodeAttrFilter)
30123017parseAttrFilter = withObject "NonEmpty NodeAttrFilter" parse
30133018 where parse o = case HM.toList o of
3014− [] -> fail "Expected non-empty list of NodeAttrFilters"
3019+ [] -> fail "Expected non-empty list of NodeAttrFilters"
30153020 x:xs -> DT.mapM (uncurry parse') (x :| xs)
30163021 parse' n = withText "Text" $ \t ->
30173022 case T.splitOn "," t of
30183023 fv:fvs -> return (NodeAttrFilter (NodeAttrName n) (fv :| fvs))
3019− [] -> fail "Expected non-empty list of filter values"
3024+ [] -> fail "Expected non-empty list of filter values"
30203025
30213026instance ToJSON ReplicaBounds where
30223027 toJSON (ReplicasBounded a b) = String (showText a <> "-" <> showText b)
@@ -3070,12 +3075,12 @@ instance ToJSON FSType where
30703075
30713076instance FromJSON FSType where
30723077 parseJSON = withText "FSType" parse
3073− where parse "simple" = pure FSSimple
3078+ where parse "simple" = pure FSSimple
30743079 parse "buffered" = pure FSBuffered
3075− parse t = fail ("Invalid FSType: " <> show t)
3080+ parse t = fail ("Invalid FSType: " <> show t)
30763081
30773082instance ToJSON CompoundFormat where
3078− toJSON (CompoundFileFormat x) = Bool x
3083+ toJSON (CompoundFileFormat x) = Bool x
30793084 toJSON (MergeSegmentVsTotalIndex x) = toJSON x
30803085
30813086instance FromJSON CompoundFormat where
@@ -3193,7 +3198,7 @@ instance ToJSON Search where
31933198 , "track_scores" .= sTrackSortScores
31943199 , "fields" .= sFields
31953200 , "_source" .= sSource]
3196−
3201+
31973202 where query' = case sFilter of
31983203 Nothing -> mquery
31993204 Just x -> Just . QueryBoolQuery $ mkBoolQuery (maybeToList mquery) [x] [] []
@@ -3334,8 +3339,8 @@ instance ToJSON SortMode where
33343339
33353340
33363341instance ToJSON Missing where
3337− toJSON LastMissing = String "_last"
3338− toJSON FirstMissing = String "_first"
3342+ toJSON LastMissing = String "_last"
3343+ toJSON FirstMissing = String "_first"
33393344 toJSON (CustomMissing txt) = String txt
33403345
33413346
@@ -3351,7 +3356,7 @@ instance FromJSON ScoreType where
33513356 parse "avg" = pure ScoreTypeAvg
33523357 parse "sum" = pure ScoreTypeSum
33533358 parse "none" = pure ScoreTypeNone
3354− parse t = fail ("Unexpected ScoreType: " <> show t)
3359+ parse t = fail ("Unexpected ScoreType: " <> show t)
33553360
33563361instance ToJSON Distance where
33573362 toJSON (Distance dCoefficient dUnit) =
@@ -3369,7 +3374,7 @@ instance FromJSON Distance where
33693374 validForNumber '-' = True
33703375 validForNumber '.' = True
33713376 validForNumber 'e' = True
3372− validForNumber c = isNumber c
3377+ validForNumber c = isNumber c
33733378 parseCoeff "" = fail "Empty string cannot be parsed as number"
33743379 parseCoeff s = return (read (T.unpack s))
33753380
@@ -3396,7 +3401,7 @@ instance FromJSON DistanceUnit where
33963401 parse "cm" = pure Centimeters
33973402 parse "mm" = pure Millimeters
33983403 parse "nmi" = pure NauticalMiles
3399− parse u = fail ("Unrecognized DistanceUnit: " <> show u)
3404+ parse u = fail ("Unrecognized DistanceUnit: " <> show u)
34003405
34013406instance ToJSON DistanceType where
34023407 toJSON Arc = String "arc"
@@ -3405,21 +3410,21 @@ instance ToJSON DistanceType where
34053410
34063411instance FromJSON DistanceType where
34073412 parseJSON = withText "DistanceType" parse
3408− where parse "arc" = pure Arc
3413+ where parse "arc" = pure Arc
34093414 parse "sloppy_arc" = pure SloppyArc
3410− parse "plane" = pure Plane
3411− parse t = fail ("Unrecognized DistanceType: " <> show t)
3415+ parse "plane" = pure Plane
3416+ parse t = fail ("Unrecognized DistanceType: " <> show t)
34123417
34133418
34143419instance ToJSON OptimizeBbox where
3415− toJSON NoOptimizeBbox = String "none"
3420+ toJSON NoOptimizeBbox = String "none"
34163421 toJSON (OptimizeGeoFilterType gft) = toJSON gft
34173422
34183423instance FromJSON OptimizeBbox where
34193424 parseJSON v = withText "NoOptimizeBbox" parseNoOptimize v
34203425 <|> parseOptimize v
34213426 where parseNoOptimize "none" = pure NoOptimizeBbox
3422− parseNoOptimize _ = mzero
3427+ parseNoOptimize _ = mzero
34233428 parseOptimize = fmap OptimizeGeoFilterType . parseJSON
34243429
34253430instance ToJSON GeoBoundingBoxConstraint where
@@ -4202,7 +4207,7 @@ instance SnapshotRepo FsSnapshotRepo where
42024207
42034208parseRepo :: Parser a -> Either SnapshotRepoConversionError a
42044209parseRepo parser = case parseEither (const parser) () of
4205− Left e -> Left (OtherRepoConversionError (T.pack e))
4210+ Left e -> Left (OtherRepoConversionError (T.pack e))
42064211 Right a -> Right a
42074212
42084213
@@ -4683,7 +4688,7 @@ instance FromJSON NodeProcessStats where
46834688 <*> o .: "open_file_descriptors"
46844689 <*> o .: "max_file_descriptors"
46854690 <*> cpu .: "percent"
4686− <*> (unMS <$> cpu .: "total_in_millis")
4691+ <*> (unMS <$> cpu .: "total_in_millis")
46874692 <*> mem .: "total_virtual_in_bytes"
46884693
46894694instance FromJSON NodeOSStats where
@@ -4720,7 +4725,7 @@ instance FromJSON NodeIndicesStats where
47204725 where
47214726 parse o = do
47224727 let (.::) mv k = case mv of
4723− Just v -> Just <$> v .: k
4728+ Just v -> Just <$> v .: k
47244729 Nothing -> pure Nothing
47254730 mRecovery <- o .:? "recovery"
47264731 mQueryCache <- o .:? "query_cache"
@@ -4965,8 +4970,8 @@ parseStringInterval s = case span isNumber s of
49654970 ("", _) -> fail "Invalid interval"
49664971 (nS, unitS) -> case (readMay nS, readMay unitS) of
49674972 (Just n, Just unit) -> return (fromInteger (n * unitNDT unit))
4968− (Nothing, _) -> fail "Invalid interval number"
4969− (_, Nothing) -> fail "Invalid interval unit"
4973+ (Nothing, _) -> fail "Invalid interval number"
4974+ (_, Nothing) -> fail "Invalid interval unit"
49704975 where
49714976 unitNDT Seconds = 1
49724977 unitNDT Minutes = 60
@@ -4985,8 +4990,8 @@ instance FromJSON ThreadPoolSize where
49854990 parseAsString = withText "ThreadPoolSize" $ \t ->
49864991 case first (readMay . T.unpack) (T.span isNumber t) of
49874992 (Just n, "k") -> return (ThreadPoolBounded (n * 1000))
4988− (Just n, "") -> return (ThreadPoolBounded n)
4989− _ -> fail ("Invalid thread pool size " <> T.unpack t)
4993+ (Just n, "") -> return (ThreadPoolBounded n)
4994+ _ -> fail ("Invalid thread pool size " <> T.unpack t)
49904995
49914996instance FromJSON ThreadPoolType where
49924997 parseJSON = withText "ThreadPoolType" parse
@@ -5001,10 +5006,10 @@ instance FromJSON NodeTransportInfo where
50015006 where
50025007 parse o = NodeTransportInfo <$> (maybe (return mempty) parseProfiles =<< o .:? "profiles")
50035008 <*> parseJSON (Object o)
5004− parseProfiles (Object o) | HM.null o = return []
5009+ parseProfiles (Object o) | HM.null o = return []
50055010 parseProfiles v@(Array _) = parseJSON v
5006− parseProfiles Null = return []
5007− parseProfiles _ = fail "Could not parse profiles"
5011+ parseProfiles Null = return []
5012+ parseProfiles _ = fail "Could not parse profiles"
50085013
50095014instance FromJSON NodeNetworkInfo where
50105015 parseJSON = withObject "NodeNetworkInfo" parse
@@ -5025,4 +5030,4 @@ newtype MaybeNA a = MaybeNA { unMaybeNA :: Maybe a }
50255030
50265031instance FromJSON a => FromJSON (MaybeNA a) where
50275032 parseJSON (String "NA") = pure $ MaybeNA Nothing
5028− parseJSON o = MaybeNA . Just <$> parseJSON o
5033+ parseJSON o = MaybeNA . Just <$> parseJSON o