hxt-9.3.1.9: A collection of tools for processing XML with Haskell.

Portabilityportable
Stabilitystable
MaintainerUwe Schmidt (uwe@fh-wedel.de)
Safe HaskellNone

Text.XML.HXT.Arrow.XmlState.TypeDefs

Description

the basic state arrows for XML processing

A state is needed for global processing options, like encoding options, document base URI, trace levels and error message handling

The state is separated into a user defined state and a system state. The system state contains variables for error message handling, for tracing, for the document base for accessing XML documents with relative references, e.g. DTDs, and a global key value store. This assoc list has strings as keys and lists of XmlTrees as values. It is used to store arbitrary XML and text values, e.g. user defined global options.

The user defined part of the store is in the default case empty, defined as (). It can be extended with an arbitray data type

Synopsis

Documentation

data XIOState us Source

state datatype consists of a system state and a user state the user state is not fixed

Constructors

XIOState 

Instances

NFData us => NFData (XIOState us) 

type IOStateArrow s b c = IOSLA (XIOState s) b cSource

The arrow type for stateful arrows

type IOSArrow b c = IOStateArrow () b cSource

The arrow for stateful arrows with no user defined state

getUserState :: IOStateArrow s b sSource

read the user defined part of the state

changeUserState :: (b -> s -> s) -> IOStateArrow s b bSource

change the user defined part of the state

setUserState :: IOStateArrow s s sSource

set the user defined part of the state

withExtendedUserState :: s1 -> IOStateArrow (s1, s0) b c -> IOStateArrow s0 b cSource

extend user state

Run an arrow with an extended user state component, The old component is stored together with a new one in a pair, the arrow is executed with this extended state, and the augmented state component is removed form the state when the arrow has finished its execution

withOtherUserState :: s1 -> IOStateArrow s1 b c -> IOStateArrow s0 b cSource

change the type of user state

This conversion is useful, when running a state arrow with another structure of the user state, e.g. with () when executing some IO arrows

data XIOSysState Source

predefined system state data type with all components for the system functions, like trace, error handling, ...

Constructors

XIOSys 

Instances

NFData XIOSysState 

data XIOOutputConfig Source

Constructors

XIOOcfg 

Fields

xioIndent :: !Bool
 
xioOutputEncoding :: !String
 
xioOutputFmt :: !XIOXoutConfig
 
xioXmlPi :: !Bool
 
xioNoEmptyElemFor :: ![String]
 
xioAddDefaultDTD :: !Bool
 
xioTextMode :: !Bool
 
xioShowTree :: !Bool
 
xioShowHaskell :: !Bool
 

type CompressionFct = ByteString -> ByteStringSource

type DeCompressionFct = ByteString -> ByteStringSource

theTraceCmd :: Selector XIOSysState (Int -> String -> IO ())Source

theTrace :: Selector XIOSysState (Int, Int -> String -> IO ())Source

theBinaryCompression :: Selector XIOSysState (ByteString -> ByteString)Source

theBinaryDeCompression :: Selector XIOSysState (ByteString -> ByteString)Source

chgSysVar :: Selector XIOSysState c -> (b -> c -> c) -> IOStateArrow s b bSource

setSysAttr :: String -> IOStateArrow s String StringSource

store a string in global state under a given attribute name

unsetSysAttr :: String -> IOStateArrow s b bSource

remove an entry in global state, arrow input remains unchanged

getSysAttr :: String -> IOStateArrow s b StringSource

read an attribute value from global state

getAllSysAttrs :: IOStateArrow s b AttributesSource

read all attributes from global state

setSysAttrString :: String -> String -> IOStateArrow s b bSource

setSysAttrInt :: String -> Int -> IOStateArrow s b bSource

store an int value in global state

getSysAttrInt :: Int -> String -> IOStateArrow s b IntSource

read an int value from global state

 getSysAttrInt 0 myIntAttr

toInt :: Int -> String -> IntSource

data Selector s a Source

A Selector is a pair of an access function and a modifying function for reading and updating parts of a composite type

Constructors

S 

Fields

getS :: s -> a
 
setS :: a -> s -> s
 

Instances

Category Selector 

chgS :: Selector s a -> (a -> a) -> s -> sSource

(.&&&.) :: Selector s a -> Selector s b -> Selector s (a, b)Source