extra 1.6.9 → 1.6.11
raw patch · 5 files changed
+13/−8 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +4/−0
- extra.cabal +1/−1
- src/Data/List/Extra.hs +4/−3
- src/System/Time/Extra.hs +2/−2
- test/TestGen.hs +2/−2
CHANGES.txt view
@@ -1,5 +1,9 @@ Changelog for Extra +1.6.11, released 2018-09-18+ #38, make escapeHTML replace ' with '+1.6.10, released 2018-09-04+ #37, make a duration/sleep test more robust (wider bounds) 1.6.9, released 2018-07-12 Add loop, the non-monadic version of loopM #36, add whenMaybe and whenMaybeM
extra.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: extra-version: 1.6.9+version: 1.6.11 license: BSD3 license-file: LICENSE category: Development
src/Data/List/Extra.hs view
@@ -285,12 +285,11 @@ -- | Escape a string such that it can be inserted into an HTML document or @\"@ attribute -- without any special interpretation. This requires escaping the @<@, @>@, @&@ and @\"@ characters.--- Note that it does /not/ escape @\'@, so will not work when placed in a @\'@ delimited attribute.--- Also note that it will escape @\"@ even though that is not required in an HTML body (but is not harmful).+-- Note that it will escape @\"@ and @\'@ even though that is not required in an HTML body (but is not harmful). -- -- > escapeHTML "this is a test" == "this is a test" -- > escapeHTML "<b>\"g&t\"</n>" == "<b>"g&t"</n>"--- > escapeHTML "don't" == "don't"+-- > escapeHTML "t'was another test" == "t'was another test" escapeHTML :: String -> String escapeHTML = concatMap f where@@ -298,6 +297,7 @@ f '<' = "<" f '&' = "&" f '\"' = """+ f '\'' = "'" f x = [x] -- | Invert of 'escapeHTML' (does not do general HTML unescaping)@@ -309,6 +309,7 @@ | Just xs <- stripPrefix "gt;" xs = '>' : unescapeHTML xs | Just xs <- stripPrefix "amp;" xs = '&' : unescapeHTML xs | Just xs <- stripPrefix "quot;" xs = '\"' : unescapeHTML xs+ | Just xs <- stripPrefix "#39;" xs = '\'' : unescapeHTML xs unescapeHTML (x:xs) = x : unescapeHTML xs unescapeHTML [] = []
src/System/Time/Extra.hs view
@@ -63,7 +63,7 @@ | otherwise = do pid <- myThreadId ex <- fmap Timeout newUnique- handleBool (== ex) + handleBool (== ex) (const $ return Nothing) (bracket (forkIOWithUnmask $ \unmask -> unmask $ sleep n >> throwTo pid ex) killThread@@ -107,7 +107,7 @@ -- | Record how long a computation takes in 'Seconds'. ----- > do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.1+-- > do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.5 duration :: IO a -> IO (Seconds, a) duration act = do time <- offsetTime
test/TestGen.hs view
@@ -142,7 +142,7 @@ testGen "line1 \"test\\nrest\\nmore\" == (\"test\",\"rest\\nmore\")" $ line1 "test\nrest\nmore" == ("test","rest\nmore") testGen "escapeHTML \"this is a test\" == \"this is a test\"" $ escapeHTML "this is a test" == "this is a test" testGen "escapeHTML \"<b>\\\"g&t\\\"</n>\" == \"<b>"g&t"</n>\"" $ escapeHTML "<b>\"g&t\"</n>" == "<b>"g&t"</n>"- testGen "escapeHTML \"don't\" == \"don't\"" $ escapeHTML "don't" == "don't"+ testGen "escapeHTML \"t'was another test\" == \"t'was another test\"" $ escapeHTML "t'was another test" == "t'was another test" testGen "\\xs -> unescapeHTML (escapeHTML xs) == xs" $ \xs -> unescapeHTML (escapeHTML xs) == xs testGen "escapeJSON \"this is a test\" == \"this is a test\"" $ escapeJSON "this is a test" == "this is a test" testGen "escapeJSON \"\\ttab\\nnewline\\\\\" == \"\\\\ttab\\\\nnewline\\\\\\\\\"" $ escapeJSON "\ttab\nnewline\\" == "\\ttab\\nnewline\\\\"@@ -274,4 +274,4 @@ testGen "showDuration 62003.8 == \"17h13m\"" $ showDuration 62003.8 == "17h13m" testGen "showDuration 1e8 == \"27777h47m\"" $ showDuration 1e8 == "27777h47m" testGen "do f <- offsetTime; xs <- replicateM 10 f; return $ xs == sort xs" $ do f <- offsetTime; xs <- replicateM 10 f; return $ xs == sort xs- testGen "do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.1" $ do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.1+ testGen "do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.5" $ do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.5