Upgrade protolude to 0.3.1

This commit is contained in:
Laurence Isla
2022-06-08 11:41:39 -05:00
committed by GitHub
parent 4ff2469f57
commit f9688c3553
6 changed files with 39 additions and 15 deletions
+3 -3
View File
@@ -359,17 +359,17 @@ parser optPath env dbSettings =
coerceInt :: (Read i, Integral i) => C.Value -> Maybe i
coerceInt (C.Number x) = rightToMaybe $ floatingOrInteger x
coerceInt (C.String x) = readMaybe $ toS x
coerceInt (C.String x) = readMaybe x
coerceInt _ = Nothing
coerceBool :: C.Value -> Maybe Bool
coerceBool (C.Bool b) = Just b
coerceBool (C.String s) =
-- parse all kinds of text: True, true, TRUE, "true", ...
case readMaybe . toS $ T.toTitle $ T.filter isAlpha $ toS s of
case readMaybe $ T.toTitle $ T.filter isAlpha $ toS s of
Just b -> Just b
-- numeric instead?
Nothing -> (> 0) <$> (readMaybe $ toS s :: Maybe Integer)
Nothing -> (> 0) <$> (readMaybe s :: Maybe Integer)
coerceBool _ = Nothing
splitOnCommas :: C.Value -> [Text]
+2 -2
View File
@@ -201,10 +201,10 @@ parse qs =
o = rangeOffset ro
limitParams =
M.fromList [(k, restrictRange (readMaybe $ toS v) allRange) | (k,v) <- limits]
M.fromList [(k, restrictRange (readMaybe v) allRange) | (k,v) <- limits]
offsetParams =
M.fromList [(k, maybe allRange rangeGeq (readMaybe $ toS v)) | (k,v) <- offsets]
M.fromList [(k, maybe allRange rangeGeq (readMaybe v)) | (k,v) <- offsets]
operator :: Text -> Maybe SimpleOperator
operator = \case