]> www.average.org Git - pdns-pipe-nmc.git/blob - test.hs
966186f62ef379ee6e39c3a7be31420efbbde670
[pdns-pipe-nmc.git] / test.hs
1 {-# LANGUAGE OverloadedStrings #-}
2
3 module Main where
4
5 import Prelude hiding (readFile)
6 import Data.ByteString.Lazy (ByteString)
7 import Data.ByteString.Lazy.Char8 (unpack, readFile)
8 import System.IO.Error
9 import Control.Exception
10
11 import NmcDom
12
13 queryOp :: ByteString -> IO (Either String ByteString)
14 queryOp key = catch (readFile (unpack key) >>= return . Right)
15                     (\e -> return (Left (show (e :: IOException))))
16
17 main = do
18         d <- mergeImport queryOp (emptyNmcDom {domImport = Just "d/root"})
19         putStrLn $ show d
20