Updated to read from stdin/file
parent
e50081614a
commit
1fcce32ef6
@ -1,8 +1,27 @@
|
||||
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 = fmap reverse $ readLinesHelper []
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
let res = fst $ leftmostLongestParse parseDocument "# _Hello_\n"
|
||||
putStrLn (show res)
|
||||
args <- getArgs
|
||||
fileContents <- case args of
|
||||
[] -> getContents
|
||||
x : _ -> readFile x
|
||||
let res = fst $ leftmostLongestParse parseDocument fileContents
|
||||
print res
|
||||
|
Loading…
Reference in New Issue