encoding 0.9 → 0.10
raw patch · 3 files changed
+19/−15 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- System.IO.Encoding: getSystemEncoding :: IO DynEncoding
+ System.IO.Encoding: getSystemEncoding :: IO (Maybe DynEncoding)
Files
- CHANGELOG +8/−0
- System/IO/Encoding.hs +9/−9
- encoding.cabal +2/−6
CHANGELOG view
@@ -1,3 +1,11 @@+Changes from 0.9 to 0.10+---------------------------++* Provide the getSystemEncoding function always, improving portability (#26).+ - The `getSystemEncoding` function is now present on all platforms.+ - *Breaking change*: It now returns `Nothing` if there is an error, or if running on Windows. The result type, therefore, is `Maybe DynEncoding`.+ - The `systemEncoding` flag has been dropped.+ Changes from 0.8.10 to 0.9 ---------------------------
System/IO/Encoding.hs view
@@ -135,19 +135,19 @@ line <- hGetLine stdin hPutStrLn stdout (f line) -#ifdef SYSTEM_ENCODING+#ifndef mingw32_HOST_OS foreign import ccall "system_encoding.h get_system_encoding" get_system_encoding :: IO CString #endif --- | Returns the encoding used on the current system. Currently only supported--- on Linux-alikes.-getSystemEncoding :: IO DynEncoding+-- | On unix machines, returns the system's currently configured text encoding,+-- or Nothing if there was an error. On Windows, currently always returns Nothing.+getSystemEncoding :: IO (Maybe DynEncoding) getSystemEncoding = do-#ifdef SYSTEM_ENCODING- enc <- get_system_encoding- str <- peekCString enc- return $ encodingFromString str+#ifndef mingw32_HOST_OS+ enc <- get_system_encoding+ str <- peekCString enc+ return $ encodingFromStringExplicit str #else- error "getSystemEncoding is not supported on this platform"+ return Nothing #endif
encoding.cabal view
@@ -1,5 +1,5 @@ Name: encoding-Version: 0.9+Version: 0.10 Author: Henning Günther Maintainer: daniel@wagner-home.com, Andrey Prokopenko License: BSD3@@ -18,9 +18,6 @@ system_encoding.h system_encoding.c -Flag systemEncoding- description: Provide the getSystemEncoding action to query the locale.- Flag generate-encodings description: Generate encodings. manual: True@@ -114,14 +111,13 @@ Data.CharMap if impl(ghc >= 7.10) GHC-Options: -fno-warn-tabs- if flag(systemEncoding)+ if !os(windows) Includes: system_encoding.h Install-Includes: system_encoding.h C-Sources: system_encoding.c- CPP-Options: -DSYSTEM_ENCODING executable encoding-exe main-is: Main.hs