<commit_before>{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
-- | Pretty printing and formatting of GHC errors.
module Server.Errors
  ( GHCError(), location, message, style
  , showError
  , collectErrors
  , errorToMessage
  , makeRelativeLocation
  ) where

import           Control.Concurrent.MVar
import           Control.Lens
import           Control.Monad
import qualified Data.DList as DL
import           Data.Data.Lens
import qualified Data.Text as T
import qualified DynFlags
import qualified ErrUtils
import qualified FastString as FS
import qualified GHC
import           Message
import qualified Outputable
import qualified Pretty
import qualified SrcLoc
import           System.Exit
import           System.FilePath

-- | A data type holding all the information of a GHC error message.
data GHCError = GHCError
  { _severity       :: GHC.Severity
  , _location       :: GHC.SrcSpan
  , _style          :: Outputable.PprStyle
  , _message        :: Outputable.SDoc
  , _renderDoc      :: Outputable.SDoc -> Outputable.PprStyle -> String
  }
makeLenses ''GHCError<commit_msg>Fix redundant import on GHC 7.4<commit_after>{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
-- | Pretty printing and formatting of GHC errors.
module Server.Errors
  ( GHCError(), location, message, style
  , showError
  , collectErrors
  , errorToMessage
  , makeRelativeLocation
  ) where

import           Control.Concurrent.MVar
import           Control.Lens
import           Control.Monad
import qualified Data.DList as DL
import           Data.Data.Lens
import qualified Data.Text as T
import qualified DynFlags
import qualified ErrUtils
import qualified FastString as FS
import qualified GHC
import           Message
import qualified Outputable
import qualified SrcLoc
import           System.Exit
import           System.FilePath
#if __GLASGOW_HASKELL__ >= 706
import qualified Pretty
#endif

-- | A data type holding all the information of a GHC error message.
data GHCError = GHCError
  { _severity       :: GHC.Severity
  , _location       :: GHC.SrcSpan
  , _style          :: Outputable.PprStyle
  , _message        :: Outputable.SDoc
  , _renderDoc      :: Outputable.SDoc -> Outputable.PprStyle -> String
  }
makeLenses ''GHCError
{'fraction_non_alphanumeric': 0.07118205349439172, 'fraction_numerical': 0.0021570319240724763, 'mean_word_length': 2.9305084745762713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1417709', 'n_tokens_mistral': 673, 'n_tokens_neox': 656, 'n_words': 210}