File: Main.hs

package info (click to toggle)
haskell-feed 0.3.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 408 kB
  • sloc: haskell: 3,403; xml: 1,096; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 456 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Main where

import Text.XML.Light
import Text.Feed.Types
import Text.Feed.Import
import Text.Feed.Export

import System.Environment

pFromFile :: FilePath -> IO Feed
pFromFile fp = do
  ls <- readFile fp
  case parseFeedString ls of
    Nothing -> fail ("parseFeedFromFile: not a well-formed XML content in: " ++ fp)
    Just f  -> return f

main :: IO ()
main = do
  (x:_) <- getArgs
  feed  <- pFromFile x
  putStrLn (ppTopElement $ xmlFeed feed)