From 16dc1b62a74ef667618b2df268665c9fdb970725 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 6 Aug 2017 15:55:21 -0400 Subject: [PATCH] Define an errorSyntax helper constructor. --- src/Data/Syntax.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Data/Syntax.hs b/src/Data/Syntax.hs index a0579d492..7f63d3922 100644 --- a/src/Data/Syntax.hs +++ b/src/Data/Syntax.hs @@ -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)