module Text.XML.HXT.Arrow.XmlState.MimeTypeTable
where
import Control.Arrow
import Control.Arrow.ArrowList
import Control.Arrow.ArrowIO
import Text.XML.HXT.DOM.Interface
import Text.XML.HXT.Arrow.XmlState.TypeDefs
setMimeTypeTable :: MimeTypeTable -> IOStateArrow s b b
setMimeTypeTable :: forall s b. MimeTypeTable -> IOStateArrow s b b
setMimeTypeTable MimeTypeTable
mtt = forall s c. SysConfig -> IOStateArrow s c c
configSysVar forall a b. (a -> b) -> a -> b
$ forall s a. Selector s a -> a -> s -> s
setS (Selector XIOSysState MimeTypeTable
theMimeTypes forall s a b. Selector s a -> Selector s b -> Selector s (a, b)
.&&&. Selector XIOSysState String
theMimeTypeFile) (MimeTypeTable
mtt, String
"")
setMimeTypeTableFromFile :: FilePath -> IOStateArrow s b b
setMimeTypeTableFromFile :: forall s b. String -> IOStateArrow s b b
setMimeTypeTableFromFile String
file = forall s c. SysConfig -> IOStateArrow s c c
configSysVar forall a b. (a -> b) -> a -> b
$ forall s a. Selector s a -> a -> s -> s
setS Selector XIOSysState String
theMimeTypeFile String
file
getMimeTypeTable :: IOStateArrow s b MimeTypeTable
getMimeTypeTable :: forall s b. IOStateArrow s b MimeTypeTable
getMimeTypeTable = forall {s} {c}.
(MimeTypeTable, String) -> IOSLA (XIOState s) c MimeTypeTable
getMime forall (a :: * -> * -> *) c b d.
ArrowList a =>
(c -> a b d) -> a b c -> a b d
$< forall c s b. Selector XIOSysState c -> IOStateArrow s b c
getSysVar (Selector XIOSysState MimeTypeTable
theMimeTypes forall s a b. Selector s a -> Selector s b -> Selector s (a, b)
.&&&. Selector XIOSysState String
theMimeTypeFile)
where
getMime :: (MimeTypeTable, String) -> IOSLA (XIOState s) c MimeTypeTable
getMime (MimeTypeTable
mtt, String
"") = forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA MimeTypeTable
mtt
getMime (MimeTypeTable
_, String
mtf) = forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b b
perform (forall s b. MimeTypeTable -> IOStateArrow s b b
setMimeTypeTable forall (a :: * -> * -> *) c b d.
ArrowList a =>
(c -> a b d) -> a b c -> a b d
$< forall (a :: * -> * -> *) c b. ArrowIO a => IO c -> a b c
arrIO0 ( String -> IO MimeTypeTable
readMimeTypeTable String
mtf))
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>>
forall s b. IOStateArrow s b MimeTypeTable
getMimeTypeTable