aboutsummaryrefslogtreecommitdiff
path: root/src/Exit.hs
blob: 1a089314af1827a6ab14cfa7b717928e3561ea4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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