module Hoogle.Type.ParseError where
import Hoogle.Type.TagStr
import Data.Data
data ParseError = ParseError
{lineNo :: Int
,columnNo :: Int
,errorMessage :: String
,parseInput :: TagStr
} deriving (Ord,Eq,Data,Typeable)
instance Show ParseError where
show (ParseError line col err _) = "Parse error " ++ show line ++ ":" ++ show col ++ ": " ++ err
parseErrorWith :: Int -> Int -> String -> String -> ParseError
parseErrorWith line col err text = ParseError line col err $ Tags [Str pre, TagEmph $ Str $ post ++ post2]
where
(pre,post) = splitAt (col1) text
post2 = if null post then " " else ""