with-utf8 1.0.2.3 → 1.0.2.4
raw patch · 7 files changed
+32/−30 lines, 7 filesdep ~basedep ~textnew-uploader
Dependency ranges changed: base, text
Files
- CHANGELOG.md +7/−1
- app/utf8-troubleshoot/Main.hs +8/−8
- lib/Main/Utf8.hs +1/−1
- lib/System/IO/Utf8.hs +1/−1
- lib/System/IO/Utf8/Internal.hs +2/−3
- test/Test/Utf8/ReadWrite.hs +5/−6
- with-utf8.cabal +8/−10
CHANGELOG.md view
@@ -1,8 +1,14 @@ # Changelog -## Unreleased+## 1.0.2.4 +### Changed++- Allow base 4.17, 4.18 (GHC 9.4, 9.6).+- Allow text<2.1++## 1.0.2.2 ## 1.0.2.3
app/utf8-troubleshoot/Main.hs view
@@ -2,9 +2,9 @@ -- -- SPDX-License-Identifier: MPL-2.0 -{-# LANGUAGE CPP #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} #include <HsBaseConfig.h>@@ -57,7 +57,7 @@ putStr $ " * " <> name <> " " lookupEnv name >>= \case Nothing -> putStrLn "is not set"- Just v -> putStrLn $ "= " <> v+ Just v -> putStrLn $ "= " <> v showSystem :: IO ()@@ -107,7 +107,7 @@ enc <- c_libcharsetEncoding >>= peekCAString putStrLn $ " * libcharset:locale_charset = " <> enc #else- putStrLn $ " * No libcharset."+ putStrLn " * No libcharset." #endif showLanginfoh :: IO ()@@ -116,7 +116,7 @@ enc <- c_langinfoEncoding >>= peekCAString putStrLn $ " * langinfo.h:nl_langinfo(CODESET) = " <> enc #else- putStrLn $ " * No <langinfo.h>."+ putStrLn " * No <langinfo.h>." #endif #if defined(HAVE_LIBCHARSET)@@ -135,7 +135,7 @@ mapM_ showEnvVar [ "LANG" , "LC_CTYPE"- , "LC_ALL="+ , "LC_ALL" ] showLocales :: IO ()@@ -143,7 +143,7 @@ putStrLn "# Locales" tryIO callLocalectl >>= \case Right out -> do- putStrLn $ " * localectl list-locales:"+ putStrLn " * localectl list-locales:" showLocaleList (lines out) Left _ -> do listDir "/usr/lib/locale"
lib/Main/Utf8.hs view
@@ -62,7 +62,7 @@ bracket (liftIO $ getLocaleEncoding <* setLocaleEncoding utf8) (liftIO . setLocaleEncoding)- (\_ -> act)+ (const act) -- | Make standard handles safe to write anything to them. --
lib/System/IO/Utf8.hs view
@@ -3,7 +3,7 @@ - SPDX-License-Identifier: MPL-2.0 -} -{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE LambdaCase #-} ----------------------------------------------------------------------------- -- |
lib/System/IO/Utf8/Internal.hs view
@@ -3,8 +3,7 @@ - SPDX-License-Identifier: MPL-2.0 -} -{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE ViewPatterns #-}+{-# LANGUAGE LambdaCase #-} -- | Internal functions that implement encoding selection logic. module System.IO.Utf8.Internal@@ -83,4 +82,4 @@ | "//TRANSLIT" `isSuffixOf` name -> pure Keep | otherwise -> hIsTerm h >>= \case False -> pure $ ChangeFromTo enc (textEncodingName utf8)- True -> pure $ ChangeFromTo enc (name ++ "//TRANSLIT")+ True -> pure $ ChangeFromTo enc (name ++ "//TRANSLIT")
test/Test/Utf8/ReadWrite.hs view
@@ -3,8 +3,8 @@ - SPDX-License-Identifier: MPL-2.0 -} -{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} module Test.Utf8.ReadWrite where@@ -18,7 +18,7 @@ import GHC.IO.Encoding (utf8) import System.IO.Temp (withSystemTempFile) -import Hedgehog (Property, (===), forAll, property)+import Hedgehog (Property, forAll, property, (===)) import Test.HUnit (Assertion, assertFailure) import qualified Data.Text.IO as T@@ -59,7 +59,7 @@ hprop_writeFile :: Property hprop_writeFile = property $ do str <- forAll $ G.text (R.linear 0 1000) G.unicode- liftIO $ withTestFile str (flip Utf8.writeFile str)+ liftIO $ withTestFile str (`Utf8.writeFile` str) hprop_openFile :: Property hprop_openFile = property $ do@@ -78,6 +78,5 @@ str' <- liftIO $ withTestFile str $ \fp -> Utf8.withFile fp IO.ReadMode $ \h -> do res <- T.hGetContents h- res' <- evaluate . force $ res- pure res'+ evaluate . force $ res str === str'
with-utf8.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack------ hash: a503b7726c9828d56678af138259fcb28ff277506741565ba90bba76c86bbd3a name: with-utf8-version: 1.0.2.3+version: 1.0.2.4 synopsis: Get your IO right on the first try description: This minimalistic library helps you navigate the world of text encodings avoiding @invalid argument (invalid byte sequence)@@@ -50,9 +48,9 @@ lib ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints build-depends:- base >=4.10 && <4.17+ base >=4.10 && <4.19 , safe-exceptions ==0.1.*- , text >=0.7 && <1.3+ , text >=0.7 && <2.1 default-language: Haskell2010 executable utf8-troubleshoot@@ -65,12 +63,12 @@ c-sources: app/utf8-troubleshoot/cbits/locale.c build-depends:- base >=4.10 && <4.17+ base >=4.10 && <4.19 , directory >=1.2.5.0 && <1.4 , filepath >=1.0 && <1.5 , process >=1.0.1.1 && <1.7 , safe-exceptions- , text >=0.7 && <1.3+ , text >=0.7 && <2.1 , th-env >=0.1.0.0 && <0.2 default-language: Haskell2010 @@ -91,7 +89,7 @@ tasty-discover:tasty-discover build-depends: HUnit- , base >=4.10 && <4.17+ , base >=4.10 && <4.19 , deepseq , hedgehog , safe-exceptions@@ -99,7 +97,7 @@ , tasty-hedgehog , tasty-hunit , temporary- , text >=0.7 && <1.3+ , text >=0.7 && <2.1 , unix , with-utf8 default-language: Haskell2010