diff --git a/nix/overlays/haskell-packages.nix b/nix/overlays/haskell-packages.nix index 665a993cf..aed826247 100644 --- a/nix/overlays/haskell-packages.nix +++ b/nix/overlays/haskell-packages.nix @@ -32,6 +32,15 @@ let # To get the sha256: # nix-prefetch-url --unpack https://github.com///archive/.tar.gz + protolude = + prev.callHackageDirect + { + pkg = "protolude"; + ver = "0.3.1"; + sha256 = "0gf0mn1ycllr69kdq1p07qf7935s10jz0nnhynwqy3d6nmycxr5j"; + } + { }; + wai-extra = prev.callHackageDirect { diff --git a/postgrest.cabal b/postgrest.cabal index 21d3d4970..543be2dc9 100644 --- a/postgrest.cabal +++ b/postgrest.cabal @@ -100,7 +100,7 @@ library , network-uri >= 2.6.1 && < 2.8 , optparse-applicative >= 0.13 && < 0.17 , parsec >= 3.1.11 && < 3.2 - , protolude >= 0.3 && < 0.4 + , protolude >= 0.3.1 && < 0.4 , regex-tdfa >= 1.2.2 && < 1.4 , retry >= 0.7.4 && < 0.10 , scientific >= 0.3.4 && < 0.4 @@ -145,7 +145,7 @@ executable postgrest build-depends: base >= 4.9 && < 4.16 , containers >= 0.5.7 && < 0.7 , postgrest - , protolude >= 0.3 && < 0.4 + , protolude >= 0.3.1 && < 0.4 ghc-options: -threaded -rtsopts "-with-rtsopts=-N -I0 -qg" -O2 -Werror -Wall -fwarn-identities -fno-spec-constr -optP-Wno-nonportable-include-path @@ -226,7 +226,7 @@ test-suite spec , monad-control >= 1.0.1 && < 1.1 , postgrest , process >= 1.4.2 && < 1.7 - , protolude >= 0.3 && < 0.4 + , protolude >= 0.3.1 && < 0.4 , regex-tdfa >= 1.2.2 && < 1.4 , text >= 1.2.2 && < 1.3 , transformers-base >= 0.4.4 && < 0.5 @@ -267,7 +267,7 @@ test-suite querycost , lens-aeson >= 1.0.1 && < 1.2 , postgrest , process >= 1.4.2 && < 1.7 - , protolude >= 0.3 && < 0.4 + , protolude >= 0.3.1 && < 0.4 , regex-tdfa >= 1.2.2 && < 1.4 , wai-extra >= 3.0.19 && < 3.2 ghc-options: -O0 -Werror -Wall -fwarn-identities @@ -287,6 +287,6 @@ test-suite doctests , doctest >= 0.8 , postgrest , pretty-simple - , protolude >= 0.3 && < 0.4 + , protolude >= 0.3.1 && < 0.4 ghc-options: -threaded -O0 -Werror -Wall -fwarn-identities -fno-spec-constr -optP-Wno-nonportable-include-path diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index 9dbd08529..a623ed264 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -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] diff --git a/src/PostgREST/Request/QueryParams.hs b/src/PostgREST/Request/QueryParams.hs index 20f238a57..d03d72a28 100644 --- a/src/PostgREST/Request/QueryParams.hs +++ b/src/PostgREST/Request/QueryParams.hs @@ -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 diff --git a/stack.yaml b/stack.yaml index 8e2426c58..4cf15d5b7 100644 --- a/stack.yaml +++ b/stack.yaml @@ -12,6 +12,7 @@ nix: extra-deps: - hasql-dynamic-statements-0.3.1@sha256:c3a2c89c4a8b3711368dbd33f0ccfe46a493faa7efc2c85d3e354c56a01dfc48,2673 - hasql-implicits-0.1.0.2@sha256:5d54e09cb779a209681b139fb3cc726bae75134557932156340cc0a56dd834a8,1361 + - protolude-0.3.1@sha256:1cc9e5a5c26c33a43c52b554443dd9779fef13974eaa0beec7ca6d2551b400da,2647 - ptr-0.16.8.1@sha256:525219ec5f5da5c699725f7efcef91b00a7d44120fc019878b85c09440bf51d6,2686 - wai-extra-3.1.8@sha256:bf3dbe8f4c707b502b2a88262ed71c807220651597b76b56983f864af6197890,7280 - wai-logger-2.3.7@sha256:19a0dc5122e22d274776d80786fb9501956f5e75b8f82464bbdad5604d154d82,1671 diff --git a/stack.yaml.lock b/stack.yaml.lock index 5148fe749..540508c29 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,40 +5,54 @@ packages: - completed: - hackage: hasql-dynamic-statements-0.3.1@sha256:c3a2c89c4a8b3711368dbd33f0ccfe46a493faa7efc2c85d3e354c56a01dfc48,2673 pantry-tree: sha256: b1b9a6a26ec765e5fe29f9a670a5c9ec7067ea00dee8491f0819284ff0201b6f size: 641 + hackage: hasql-dynamic-statements-0.3.1@sha256:c3a2c89c4a8b3711368dbd33f0ccfe46a493faa7efc2c85d3e354c56a01dfc48,2673 original: hackage: hasql-dynamic-statements-0.3.1@sha256:c3a2c89c4a8b3711368dbd33f0ccfe46a493faa7efc2c85d3e354c56a01dfc48,2673 - completed: - hackage: hasql-implicits-0.1.0.2@sha256:5d54e09cb779a209681b139fb3cc726bae75134557932156340cc0a56dd834a8,1361 pantry-tree: sha256: 2f00d1467d0e226b966c2cd7bac433c8948e2f7bbdf8a44936029f66fc20b5f3 size: 310 + hackage: hasql-implicits-0.1.0.2@sha256:5d54e09cb779a209681b139fb3cc726bae75134557932156340cc0a56dd834a8,1361 original: hackage: hasql-implicits-0.1.0.2@sha256:5d54e09cb779a209681b139fb3cc726bae75134557932156340cc0a56dd834a8,1361 - completed: - hackage: ptr-0.16.8.1@sha256:525219ec5f5da5c699725f7efcef91b00a7d44120fc019878b85c09440bf51d6,2686 + pantry-tree: + sha256: 6452a6ca8d395f7d810139779bb0fd16fc1dbb00f1862630bc08ef5a100430f9 + size: 1645 + hackage: protolude-0.3.1@sha256:1cc9e5a5c26c33a43c52b554443dd9779fef13974eaa0beec7ca6d2551b400da,2647 + original: + hackage: protolude-0.3.1@sha256:1cc9e5a5c26c33a43c52b554443dd9779fef13974eaa0beec7ca6d2551b400da,2647 +- completed: pantry-tree: sha256: d2b8440a738719ef8430ec38fe33b129e3940e4ccf2c016a727a1110a43656bb size: 1089 + hackage: ptr-0.16.8.1@sha256:525219ec5f5da5c699725f7efcef91b00a7d44120fc019878b85c09440bf51d6,2686 original: hackage: ptr-0.16.8.1@sha256:525219ec5f5da5c699725f7efcef91b00a7d44120fc019878b85c09440bf51d6,2686 - completed: - hackage: wai-extra-3.1.8@sha256:bf3dbe8f4c707b502b2a88262ed71c807220651597b76b56983f864af6197890,7280 pantry-tree: sha256: a544ea95288d188e893322a8e6d68f2b1f844f772dbea1f26e5c0c1a74694f56 size: 4053 + hackage: wai-extra-3.1.8@sha256:bf3dbe8f4c707b502b2a88262ed71c807220651597b76b56983f864af6197890,7280 original: hackage: wai-extra-3.1.8@sha256:bf3dbe8f4c707b502b2a88262ed71c807220651597b76b56983f864af6197890,7280 - completed: - hackage: wai-logger-2.3.7@sha256:19a0dc5122e22d274776d80786fb9501956f5e75b8f82464bbdad5604d154d82,1671 pantry-tree: sha256: 52b5abf5c4c09bcfbc06e01f761a75c32cbd3e6ba23c8843981933fcc31ed53c size: 474 + hackage: wai-logger-2.3.7@sha256:19a0dc5122e22d274776d80786fb9501956f5e75b8f82464bbdad5604d154d82,1671 original: hackage: wai-logger-2.3.7@sha256:19a0dc5122e22d274776d80786fb9501956f5e75b8f82464bbdad5604d154d82,1671 +- completed: + pantry-tree: + sha256: 99ff839445ba2c9e29a294b45904e3f4575336c7d2b4504ce310d611661c761d + size: 3973 + hackage: warp-3.3.19@sha256:c6a47029537d42844386170d732cdfe6d85b2f4279bbaefdd9b50caff6faeebb,10910 + original: + hackage: warp-3.3.19@sha256:c6a47029537d42844386170d732cdfe6d85b2f4279bbaefdd9b50caff6faeebb,10910 snapshots: - completed: sha256: 87842ecbaa8ca9cee59a7e6be52369dbed82ed075cb4e0d152614a627e8fd488