1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Define an errorSyntax helper constructor.

This commit is contained in:
Rob Rix 2017-08-06 15:55:21 -04:00
parent 0d08387684
commit 16dc1b62a7

View File

@ -76,5 +76,8 @@ data Error a = Error { errorCallStack :: [([Char], SrcLoc)], errorExpected :: [S
instance Eq1 Error where liftEq = genericLiftEq
instance Show1 Error where liftShowsPrec = genericLiftShowsPrec
errorSyntax :: Error.Error String -> Error a
errorSyntax Error.Error{..} = Error (getCallStack callStack) errorExpected errorActual []
unError :: HasCallStack => Span -> Error a -> Error.Error String
unError span Error{..} = Error.withCallStack (fromCallSiteList errorCallStack) (Error.Error span errorExpected errorActual)