hxt 9.1.0 → 9.1.1
raw patch · 10 files changed
+57/−19 lines, 10 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Arrow.IOStateListArrow: instance NFData s => ArrowNF (IOSLA s)
- Control.Arrow.StateListArrow: instance NFData s => ArrowNF (SLA s)
+ Control.Arrow.IOStateListArrow: instance ArrowNF (IOSLA s)
+ Control.Arrow.StateListArrow: instance ArrowNF (SLA s)
+ Text.XML.HXT.Arrow.XmlState: withStrictDeserialize :: Bool -> SysConfig
+ Text.XML.HXT.Arrow.XmlState.SystemConfig: withStrictDeserialize :: Bool -> SysConfig
+ Text.XML.HXT.Arrow.XmlState.TypeDefs: theStrictDeserialize :: Selector XIOSysState Bool
+ Text.XML.HXT.Arrow.XmlState.TypeDefs: xioStrictDeserialize :: XIOCacheConfig -> !Bool
- Text.XML.HXT.Arrow.Binary: readBinaryValue :: (NFData a, Binary a) => String -> IOStateArrow s b a
+ Text.XML.HXT.Arrow.Binary: readBinaryValue :: Binary a => String -> IOStateArrow s b a
- Text.XML.HXT.Arrow.XmlState.TypeDefs: XIOCch :: CompressionFct -> DeCompressionFct -> !Bool -> !String -> !Int -> !Bool -> (String -> IOSArrow XmlTree XmlTree) -> XIOCacheConfig
+ Text.XML.HXT.Arrow.XmlState.TypeDefs: XIOCch :: CompressionFct -> DeCompressionFct -> !Bool -> !String -> !Int -> !Bool -> (String -> IOSArrow XmlTree XmlTree) -> !Bool -> XIOCacheConfig
Files
- hxt.cabal +1/−1
- src/Control/Arrow/IOListArrow.hs +1/−1
- src/Control/Arrow/IOStateListArrow.hs +11/−3
- src/Control/Arrow/ListArrow.hs +1/−1
- src/Control/Arrow/StateListArrow.hs +2/−2
- src/Text/XML/HXT/Arrow/Binary.hs +26/−11
- src/Text/XML/HXT/Arrow/XmlState.hs +1/−0
- src/Text/XML/HXT/Arrow/XmlState/RunIOStateArrow.hs +1/−0
- src/Text/XML/HXT/Arrow/XmlState/SystemConfig.hs +5/−0
- src/Text/XML/HXT/Arrow/XmlState/TypeDefs.hs +8/−0
hxt.cabal view
@@ -1,6 +1,6 @@ -- arch-tag: Haskell XML Toolbox main description file Name: hxt-Version: 9.1.0+Version: 9.1.1 Synopsis: A collection of tools for processing XML with Haskell. Description: The Haskell XML Toolbox bases on the ideas of HaXml and HXML, but introduces a more general approach for processing XML with Haskell.
src/Control/Arrow/IOListArrow.hs view
@@ -145,7 +145,7 @@ instance ArrowNF IOLA where rnfA (IOLA f) = IOLA $ \ x -> do res <- f x- deepseq res $ return res+ res `deepseq` return res instance ArrowWNF IOLA
src/Control/Arrow/IOStateListArrow.hs view
@@ -42,7 +42,9 @@ import Control.Exception ( SomeException , try )-+{-+import qualified Debug.Trace as T+-} -- ------------------------------------------------------------ -- | list arrow combined with a state and the IO monad@@ -218,10 +220,16 @@ instance ArrowNavigatableTree (IOSLA s) -instance (NFData s) => ArrowNF (IOSLA s) where+instance ArrowNF (IOSLA s) where rnfA (IOSLA f) = IOSLA $ \ s x -> do res <- f s x- deepseq res $ return res+ ( -- T.trace "start rnfA for IOSLA" $+ snd res+ )+ `deepseq`+ return ( -- T.trace "end rnfA for IOSLA" $+ res+ ) instance ArrowWNF (IOSLA s)
src/Control/Arrow/ListArrow.hs view
@@ -118,7 +118,7 @@ instance ArrowNF LA where rnfA (LA f) = LA $ \ x -> let res = f x in- deepseq res res+ res `deepseq` res instance ArrowWNF LA
src/Control/Arrow/StateListArrow.hs view
@@ -174,10 +174,10 @@ instance ArrowNavigatableTree (SLA s) -instance (NFData s) => ArrowNF (SLA s) where+instance ArrowNF (SLA s) where rnfA (SLA f) = SLA $ \ s x -> let res = f s x in- deepseq res res+ snd res `deepseq` res instance ArrowWNF (SLA s)
src/Text/XML/HXT/Arrow/Binary.hs view
@@ -25,32 +25,47 @@ import Control.Arrow.ArrowList import Control.Arrow.ArrowIO -import Control.DeepSeq- import Data.Binary import qualified Data.ByteString.Lazy as B +import System.IO ( openBinaryFile+ , hClose+ , IOMode(..)+ )+ import Text.XML.HXT.Arrow.XmlState.ErrorHandling import Text.XML.HXT.Arrow.XmlState.TypeDefs -- ------------------------------------------------------------ -readBinaryValue :: (NFData a, Binary a) => String -> IOStateArrow s b a-readBinaryValue file = flip decodeBinaryValue file $< getSysVar theBinaryDeCompression+readBinaryValue :: (Binary a) => String -> IOStateArrow s b a+readBinaryValue file+ = (uncurry $ decodeBinaryValue file)+ $< getSysVar ( theStrictDeserialize+ .&&&.+ theBinaryDeCompression+ ) -- | Read a serialied value from a file, optionally decompress it and decode the value -- In case of an error, the error message is issued and the arrow fails -decodeBinaryValue :: (NFData a, Binary a) => DeCompressionFct -> String -> IOStateArrow s b a-decodeBinaryValue decompress file- = arrIO0 ( do- r <- dec- rnf r `seq` return r- )+decodeBinaryValue :: (Binary a) => String -> Bool -> DeCompressionFct -> IOStateArrow s b a+decodeBinaryValue file strict decompress+ = arrIO0 dec `catchA` issueExc "readBinaryValue" where- dec = B.readFile file >>= return . decode . decompress+ dec = ( if strict+ then readItAll+ else B.readFile file+ ) >>= return . decode . decompress+ readItAll = do+ h <- openBinaryFile file ReadMode+ c <- B.hGetContents h+ B.length c `seq`+ do+ hClose h+ return c -- hack: force reading whole file and close it immediately -- | Serialize a value, optionally compress it, and write it to a file. -- In case of an error, the error message is issued and the arrow fails
src/Text/XML/HXT/Arrow/XmlState.hs view
@@ -115,6 +115,7 @@ , withCompression , withCheckNamespaces , withDefaultBaseURI+ , withStrictDeserialize , withEncodingErrors , withErrors , withFileMimeType
src/Text/XML/HXT/Arrow/XmlState/RunIOStateArrow.hs view
@@ -163,6 +163,7 @@ , xioDocumentAge = 0 , xioCache404Err = False , xioCacheRead = dummyCacheRead+ , xioStrictDeserialize = False } -- ------------------------------------------------------------
src/Text/XML/HXT/Arrow/XmlState/SystemConfig.hs view
@@ -230,6 +230,11 @@ withCompression :: (CompressionFct, DeCompressionFct) -> SysConfig withCompression = setS (theBinaryCompression .&&&. theBinaryDeCompression) +-- | Strict input for deserialization of binary data++withStrictDeserialize :: Bool -> SysConfig+withStrictDeserialize = setS theStrictDeserialize+ -- ------------------------------------------------------------ yes :: Bool
src/Text/XML/HXT/Arrow/XmlState/TypeDefs.hs view
@@ -240,6 +240,7 @@ , xioDocumentAge :: ! Int , xioCache404Err :: ! Bool , xioCacheRead :: String -> IOSArrow XmlTree XmlTree+ , xioStrictDeserialize :: ! Bool } type CompressionFct = ByteString -> ByteString@@ -745,6 +746,13 @@ >>> S { getS = xioCacheRead , setS = \ x s -> s { xioCacheRead = x}+ }++theStrictDeserialize :: Selector XIOSysState Bool+theStrictDeserialize = theCacheConfig+ >>>+ S { getS = xioStrictDeserialize+ , setS = \ x s -> s { xioStrictDeserialize = x} } -- ------------------------------------------------------------