gdritter repos telml-markup / 82d3235
Change the sample programs in README to exit with a non-zero return code Getty Ritter 9 years ago
1 changed file(s) with 5 addition(s) and 3 deletion(s). Collapse all Expand all
4545 import Control.Monad ((>=>))
4646 import Data.TeLML (parse)
4747 import Data.TeLML.Markup (render)
48 import System.Exit (exitFailure)
4849 import Text.Blaze.Renderer.String (renderMarkup)
4950
5051 main :: IO ()
5152 main = do
5253 str <- getContents
5354 case (parse >=> render) str of
54 Left err -> putStrLn err
55 Left err -> putStrLn err >> exitFailure
5556 Right doc -> putStrLn (renderMarkup doc)
5657 ~~~~
5758
9899 import Control.Monad ((>=>))
99100 import Data.TeLML (parse)
100101 import Data.TeLML.Markup (Renderer, renderWith)
102 import System.Exit (exitFailure)
103 import Text.Blaze.Html5 (strong, toMarkup)
101104 import Text.Blaze.Renderer.String (renderMarkup)
102 import Text.Blaze.Html5 (strong, toMarkup)
103105
104106 myTags :: [(String, Renderer)]
105107 myTags =
118120 main = do
119121 str <- getContents
120122 case (parse >=> renderWith myTags) str of
121 Left err -> putStrLn err
123 Left err -> putStrLn err >> exitFailure
122124 Right doc -> putStrLn (renderMarkup doc)
123125 ~~~~
124126