packages feed

air-extra 2013.6.14 → 2013.6.22

raw patch · 4 files changed

+17/−36 lines, 4 filesdep ~airPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: air

API changes (from Hackage documentation)

- Air.UTF8: dir_exist :: String -> IO Bool
- Air.UTF8: file_exist :: String -> IO Bool
- Air.UTF8: ls :: String -> IO [String]
- Air.UTF8: mkdir_p :: String -> IO ()
- Air.UTF8: read_file :: String -> IO String
- Air.UTF8: rm :: String -> IO ()
- Air.UTF8: rm_rf :: String -> IO ()
- Air.UTF8: write_file :: String -> String -> IO ()
- Air.Heavy: parse :: GenParser tok () a -> [tok] -> a
+ Air.Heavy: parse :: GenParser tok () a -> [tok] -> Either ParseError a
- Air.Heavy: unescape_unicode_xml :: String -> String
+ Air.Heavy: unescape_unicode_xml :: String -> Maybe String
- Air.Heavy: unescape_xml :: String -> String
+ Air.Heavy: unescape_xml :: String -> Maybe String

Files

air-extra.cabal view
@@ -1,5 +1,5 @@ Name:                 air-extra-Version:              2013.6.14+Version:              2013.6.22 Build-type:           Simple Synopsis:             air-extra Description:          An alternative Haskell Prelude library, extra helpers@@ -30,7 +30,7 @@                 , directory                 , old-locale                 , filepath-                , air+                , air >= 2013.6.22                    hs-source-dirs: src/   exposed-modules:  
src/Air/Extra.hs view
@@ -94,10 +94,12 @@      -- String camel_case, snake_case :: String -> String-camel_case = split "_" > map capitalize > join'+camel_case = split "_" > map capitalize > concat snake_case = gsub "\\B[A-Z]" "_\\&" > lower  -- IO++-- Should only be used to initialize IORefs, etc. purify :: IO a -> a purify = Unsafe.unsafePerformIO @@ -161,7 +163,7 @@ -- Text filter_comment :: String -> String filter_comment = -  lines > map strip > reject null > reject (head > (== '#')) > unlines+  lines > map strip > reject null > reject (first > (== Just '#')) > unlines  -- UTF8 b2u, u2b :: String -> String
src/Air/Heavy.hs view
@@ -12,15 +12,16 @@ -- compress    -- Parser-parse :: P.GenParser tok () a -> [tok] -> a-parse p s = case (P.parse p "" s) of-  Left err -> err.show.error-  Right x  -> x+parse :: P.GenParser tok () a -> [tok] -> Either P.ParseError a+parse p s = P.parse p "" s   -- XML-unescape_xml, escape_xml :: String -> String-unescape_xml s = parse unescape_parser s+unescape_xml :: String -> Maybe String+unescape_xml s = +  case parse unescape_parser s of+    Right r -> Just r+    Left _ -> Nothing   where     unicode_char :: Parser Char     unicode_char = do@@ -33,6 +34,7 @@     unescape_parser :: Parser String     unescape_parser = many (try unicode_char <|> anyChar) +escape_xml :: String -> String escape_xml = concatMap fixChar     where       fixChar '<' = "<"@@ -43,6 +45,8 @@       fixChar c = "&#" ++ show (ord c) ++ ";"  -- backward compatible-unescape_unicode_xml, escape_unicode_xml :: String -> String+unescape_unicode_xml :: String -> Maybe String unescape_unicode_xml = unescape_xml++escape_unicode_xml :: String -> String escape_unicode_xml = escape_xml
src/Air/UTF8.hs view
@@ -7,25 +7,6 @@ import System.IO.UTF8 (readFile, writeFile) import qualified Air as Air --- io-read_file :: String -> IO String-read_file  = readFile--write_file :: String -> String -> IO ()-write_file = writeFile--ls :: String -> IO [String]-ls x = Air.ls (x.u2b) ^ map b2u--mkdir_p :: String -> IO ()-mkdir_p = u2b > createDirectoryIfMissing True--file_exist :: String -> IO Bool-file_exist = u2b > doesFileExist--dir_exist :: String -> IO Bool-dir_exist = u2b > doesDirectoryExist- split :: String -> String -> [String] split x y  = Air.split (x.u2b) (y.u2b) .map b2u @@ -40,9 +21,3 @@  strip :: String -> String strip x = Air.strip (x.u2b) .b2u--rm :: String -> IO ()-rm = u2b > removeFile--rm_rf :: String -> IO ()-rm_rf = u2b > removeDirectoryRecursive