You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
544 B
Haskell
28 lines
544 B
Haskell
module Main where
|
|
|
|
import MdToHTML
|
|
import System.Environment
|
|
import System.IO
|
|
|
|
readLinesHelper :: [String] -> IO [String]
|
|
readLinesHelper xs = do
|
|
done <- isEOF
|
|
if done
|
|
then return xs
|
|
else do
|
|
line <- getLine
|
|
let xs' = line : xs
|
|
readLinesHelper xs'
|
|
|
|
readLines :: IO [String]
|
|
readLines = reverse <$> readLinesHelper []
|
|
|
|
main :: IO ()
|
|
main = do
|
|
args <- getArgs
|
|
fileContents <- case args of
|
|
[] -> getContents
|
|
x : _ -> readFile x
|
|
let res = fst $ leftmostLongestParse parseDocument fileContents
|
|
print res
|