validity-network-uri 0.0.0.0 → 0.0.0.1
raw patch · 3 files changed
+18/−6 lines, 3 files
Files
- CHANGELOG.md +7/−0
- src/Data/Validity/URI.hs +7/−4
- validity-network-uri.cabal +4/−2
+ CHANGELOG.md view
@@ -0,0 +1,7 @@+# Changelog++## [0.0.0.1] - 2023-10-04++### Added++* Removed partial function `head` in a few places.
src/Data/Validity/URI.hs view
@@ -19,6 +19,7 @@ import Data.Char as Char import Data.List (intercalate)+import Data.Maybe (listToMaybe) import Data.Validity import Network.URI @@ -325,14 +326,16 @@ validateQuery :: String -> Validation validateQuery uriQuery = declare (unwords ["The query", show uriQuery, "is empty or starts with '?'"]) $- -- Laziness prevents the partial 'head' from blowing up.- null uriQuery || head uriQuery == '?'+ case listToMaybe uriQuery of+ Nothing -> True+ Just q -> q == '?' validateFragment :: String -> Validation validateFragment uriFragment = declare (unwords ["The fragment", show uriFragment, "is empty or starts with '#'"]) $- -- Laziness prevents the partial 'head' from blowing up.- null uriFragment || head uriFragment == '#'+ case listToMaybe uriFragment of+ Nothing -> True+ Just f -> f == '#' -- | Render a URI to a 'String', for use in testing --
validity-network-uri.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.7.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack name: validity-network-uri-version: 0.0.0.0+version: 0.0.0.1 synopsis: Validity instances for URI category: Validity homepage: https://github.com/NorfairKing/validity#readme@@ -15,6 +15,8 @@ copyright: Copyright: (c) 2022 Tom Sydney Kerckhove license: MIT build-type: Simple+extra-source-files:+ CHANGELOG.md source-repository head type: git