diff options
author | Joris | 2015-11-22 20:36:59 +0100 |
---|---|---|
committer | Joris | 2015-11-22 20:36:59 +0100 |
commit | a9bc46efe3624344573f96fafa8af194016183a2 (patch) | |
tree | a863a2c9029620b06ea617a4caaba1c621150949 /src/Exit.hs | |
parent | 3abc150dc92171129f3b8209e57f6d5bdadf5c9b (diff) |
Exit failure when there are parsing errors
Diffstat (limited to 'src/Exit.hs')
-rw-r--r-- | src/Exit.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Exit.hs b/src/Exit.hs new file mode 100644 index 0000000..1a08931 --- /dev/null +++ b/src/Exit.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Exit + ( exitWithParsingError + ) where + +import System.IO (stderr) +import System.Exit (exitFailure) + +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.IO as T + +exitWithParsingError :: FilePath -> Text -> IO () +exitWithParsingError path err = do + T.hPutStr stderr $ + T.concat + [ "Error while parsing file " + , T.pack path + , ":\n" + , err + ] + exitFailure |