]> www.average.org Git - pdns-pipe-nmc.git/blob - test.hs
3a9f8b4e0c4c2c92d4858fbdafbaa9dbf547ff26
[pdns-pipe-nmc.git] / test.hs
1 {-# LANGUAGE OverloadedStrings #-}
2
3 module Main where
4
5 import Prelude hiding (readFile)
6 import System.Environment
7 import Data.ByteString.Lazy (ByteString)
8 import Data.ByteString.Lazy.Char8 (readFile)
9 import System.IO.Error
10 import Control.Exception
11 import Text.Show.Pretty
12
13 import NmcDom
14 import NmcTransform
15
16 queryOp :: String -> IO (Either String ByteString)
17 queryOp key = catch (readFile key >>= return . Right)
18                     (\e -> return (Left (show (e :: IOException))))
19
20 main = do
21         (d:_) <- getArgs
22         descendNmcDom queryOp [] (seedNmcDom d) >>= putStrLn . ppShow
23