Add System.Environment.UTF8 wrapper v0.3.5
authorEric Mertens <emertens@galois.com>
Thu, 4 Jun 2009 20:12:47 +0000 (13:12 -0700)
committerEric Mertens <emertens@galois.com>
Thu, 4 Jun 2009 20:12:47 +0000 (13:12 -0700)
bump to 0.3.5

Data/String/UTF8.hs
System/Environment/UTF8.hs [new file with mode: 0644]
utf8-string.cabal

index 281076a..fe1589f 100644 (file)
@@ -1,5 +1,4 @@
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# OPTIONS_GHC -fallow-undecidable-instances #-}
+{-# LANGUAGE MultiParamTypeClasses, UndecidableInstances #-}
 module Data.String.UTF8
   ( -- * Representation
     UTF8
diff --git a/System/Environment/UTF8.hs b/System/Environment/UTF8.hs
new file mode 100644 (file)
index 0000000..fe838e8
--- /dev/null
@@ -0,0 +1,25 @@
+module System.Environment.UTF8
+  (getArgs, getProgName, getEnv, withArgs, withProgName, getEnvironment)
+  where
+
+import Codec.Binary.UTF8.String (decodeString)
+import qualified System.Environment as Sys
+
+getArgs :: IO [String]
+getArgs = map decodeString `fmap` Sys.getArgs
+
+getProgName :: IO String
+getProgName = decodeString `fmap` Sys.getProgName
+
+getEnv :: String -> IO String
+getEnv x = decodeString `fmap` Sys.getEnv x
+
+withArgs :: [String] -> IO a -> IO a
+withArgs = Sys.withArgs
+
+withProgName :: String -> IO a -> IO a
+withProgName = Sys.withProgName
+
+getEnvironment :: IO [(String,String)]
+getEnvironment = map f `fmap` Sys.getEnvironment
+  where f (a,b) = (decodeString a, decodeString b)
index 0585cf3..c050bb0 100644 (file)
@@ -1,5 +1,5 @@
 Name:               utf8-string
-Version:            0.3.4
+Version:            0.3.5
 Author:             Eric Mertens
 Maintainer:         emertens@galois.com
 License:            BSD3
@@ -29,6 +29,7 @@ library
   Exposed-modules:    Codec.Binary.UTF8.String
                       Codec.Binary.UTF8.Generic
                       System.IO.UTF8
+                      System.Environment.UTF8
                       Data.String.UTF8
                       Data.ByteString.UTF8
                       Data.ByteString.Lazy.UTF8