File: TestXmlCache.hs

package info (click to toggle)
haskell-hxt-cache 9.0.2-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 88 kB
  • sloc: haskell: 314; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,384 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-- -----------------------------------------------------------------------------

module Main             -- TestXmlCache
where

import Data.Maybe

import System.Environment

import Text.XML.HXT.Arrow       hiding ( readDocument )
import Text.XML.HXT.Arrow.XmlCache

main'                   :: String -> IO ()
main' url               = runX
                            ( readDocument [ ( a_trace,         v_1       )
                                           , ( a_parse_html,    v_1       )
                                           , ( a_issue_warnings, v_0      )
                                           , ( a_cache,         "./cache" )
                                           , ( a_document_age,  "10"      )     -- 10 sec., just for testing
                                           , ( a_compress,      v_1       )
                                           ] url
                              >>>
                              writeDocument [ ( a_indent,       v_1     )
                                            ] "t.xml"
                            )
                          >> return ()

main                    :: IO ()
main                    = do
                          as <- getArgs
                          main' . fromMaybe "http://www.haskell.org/" . listToMaybe $ as

-- -----------------------------------------------------------------------------