packages feed

mps 2010.1.24 → 2010.1.24.1

raw patch · 2 files changed

+57/−2 lines, 2 filesdep +base64-stringdep +zlibPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependencies added: base64-string, zlib

API changes (from Hackage documentation)

+ MPS.Heavy: escape_unicode_xml :: String -> String
+ MPS.Heavy: escape_xml :: String -> String
+ MPS.Heavy: parse :: GenParser tok () a -> [tok] -> a
+ MPS.Heavy: unescape_unicode_xml :: String -> String
+ MPS.Heavy: unescape_xml :: String -> String
+ MPS.Heavy: unzip64 :: String -> String
+ MPS.Heavy: zip64 :: String -> String

Files

mps.cabal view
@@ -1,5 +1,5 @@ Name:                 mps-Version:              2010.1.24+Version:              2010.1.24.1 Build-type:           Simple Synopsis:             simply oo Description:          DSL that allows one to write Haskell from left to right@@ -15,7 +15,7 @@  library   ghc-options: -Wall-  build-depends: base >= 4 && < 5, containers, array, parallel, old-time, time, bytestring >= 0.9, regexpr >= 0.3.4, parsec >= 2, utf8-string >= 0.3.3, directory, old-locale, filepath, template-haskell+  build-depends: base64-string, base >= 4 && < 5, zlib, containers, array, parallel, old-time, time, bytestring >= 0.9, regexpr >= 0.3.4, parsec >= 2, utf8-string >= 0.3.3, directory, old-locale, filepath, template-haskell   hs-source-dirs: src/   exposed-modules:                       MPS@@ -23,4 +23,5 @@                   , MPS.Light                   , MPS.Extra                   , MPS.Env+                  , MPS.Heavy   other-modules:    MPS.UTF8
+ src/MPS/Heavy.hs view
@@ -0,0 +1,54 @@+module MPS.Heavy where++import Codec.Binary.Base64.String as C+import Data.Char+import MPS.Light+import Prelude hiding ((.), (^), (>), (<), (/), elem, foldl)+import qualified Prelude as P+import Text.ParserCombinators.Parsec (many, char, many1, digit, (<|>), Parser, anyChar, try)+import qualified Codec.Compression.GZip as GZip+import qualified Data.ByteString.Lazy.Char8 as B+import qualified Text.ParserCombinators.Parsec as P+++-- compress++zip64, unzip64 :: String -> String+zip64 = B.pack > GZip.compress > B.unpack > C.encode+unzip64 = C.decode > B.pack > GZip.decompress > B.unpack+  +-- 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+++-- XML+unescape_xml, escape_xml :: String -> String+unescape_xml s = parse unescape_parser s+  where+    unicode_char :: Parser Char+    unicode_char = do+      char '&'+      char '#'+      word <- many1 digit+      char ';'+      return $ chr (read word)++    unescape_parser :: Parser String+    unescape_parser = many (try unicode_char <|> anyChar)++escape_xml = concatMap fixChar+    where+      fixChar '<' = "<"+      fixChar '>' = ">"+      fixChar '&' = "&"+      fixChar '"' = "\""+      fixChar c | ord c P.< 0x80 = [c]+      fixChar c = "&#" ++ show (ord c) ++ ";"++-- backward compatible+unescape_unicode_xml, escape_unicode_xml :: String -> String+unescape_unicode_xml = unescape_xml+escape_unicode_xml = escape_xml