paripari 0.5.0.0 → 0.6.0.0
raw patch · 7 files changed
+163/−81 lines, 7 filesdep ~parser-combinatorsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: parser-combinators
API changes (from Hackage documentation)
- Text.PariPari: [_reportCol] :: Report -> !Int
- Text.PariPari.Internal.Acceptor: [_envRefCol] :: Env k -> !Int
- Text.PariPari.Internal.Acceptor: [_stCol] :: State -> !Int
- Text.PariPari.Internal.Reporter: [_envRefCol] :: Env k -> !Int
- Text.PariPari.Internal.Reporter: [_reportCol] :: Report -> !Int
- Text.PariPari.Internal.Reporter: [_stCol] :: State -> !Int
- Text.PariPari.Internal.Reporter: [_stErrCol] :: State -> !Int
+ Text.PariPari: [_reportColumn] :: Report -> !Int
+ Text.PariPari.Internal.Acceptor: [_envRefColumn] :: Env k -> !Int
+ Text.PariPari.Internal.Acceptor: [_stColumn] :: State -> !Int
+ Text.PariPari.Internal.Reporter: [_envRefColumn] :: Env k -> !Int
+ Text.PariPari.Internal.Reporter: [_reportColumn] :: Report -> !Int
+ Text.PariPari.Internal.Reporter: [_stColumn] :: State -> !Int
+ Text.PariPari.Internal.Reporter: [_stErrColumn] :: State -> !Int
+ Text.PariPari.Lens: ecContext :: Lens ErrorContext [String]
+ Text.PariPari.Lens: ecErrors :: Lens ErrorContext [Error]
+ Text.PariPari.Lens: optMaxContexts :: Lens ReportOptions Int
+ Text.PariPari.Lens: optMaxErrorsPerContext :: Lens ReportOptions Int
+ Text.PariPari.Lens: optMaxLabelsPerContext :: Lens ReportOptions Int
+ Text.PariPari.Lens: posColumn :: Lens Pos Int
+ Text.PariPari.Lens: posLine :: Lens Pos Int
+ Text.PariPari.Lens: reportColumn :: Lens Report Int
+ Text.PariPari.Lens: reportErrors :: Lens Report [ErrorContext]
+ Text.PariPari.Lens: reportFile :: Lens Report FilePath
+ Text.PariPari.Lens: reportLine :: Lens Report Int
Files
- paripari.cabal +3/−2
- src/Text/PariPari/Internal/Acceptor.hs +29/−29
- src/Text/PariPari/Internal/Class.hs +18/−3
- src/Text/PariPari/Internal/ElementCombinators.hs +1/−1
- src/Text/PariPari/Internal/Reporter.hs +43/−43
- src/Text/PariPari/Internal/Tracer.hs +5/−3
- src/Text/PariPari/Lens.hs +64/−0
paripari.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 3476d5605ed3319d3b575839fb866897fc42c60890869a31d03de49938e4d20d+-- hash: cf4bf92e82b3f884f3cbfbbd9eddbf9bc6301c4fcf6e5b5dfd6362e36e8ffc49 name: paripari-version: 0.5.0.0+version: 0.6.0.0 synopsis: Parser combinators with fast-path and slower fallback for error reporting description: PariPari offers two parsing strategies. There is a fast Acceptor and a slower Reporter which are evaluated in parallel. If the Acceptor fails, the Reporter returns a report about the parsing errors. Like Attoparsec, the parser combinators backtrack by default. category: Text@@ -36,6 +36,7 @@ Text.PariPari.Internal.Reporter Text.PariPari.Internal.Run Text.PariPari.Internal.Tracer+ Text.PariPari.Lens other-modules: Paths_paripari hs-source-dirs:
src/Text/PariPari/Internal/Acceptor.hs view
@@ -22,17 +22,17 @@ import qualified Control.Monad.Fail as Fail data Env k = Env- { _envBuf :: !(Buffer k)- , _envEnd :: !Int- , _envFile :: !FilePath- , _envRefLine :: !Int- , _envRefCol :: !Int+ { _envBuf :: !(Buffer k)+ , _envEnd :: !Int+ , _envFile :: !FilePath+ , _envRefLine :: !Int+ , _envRefColumn :: !Int } data State = State- { _stOff :: !Int- , _stLine :: !Int- , _stCol :: !Int+ { _stOff :: !Int+ , _stLine :: !Int+ , _stColumn :: !Int } -- | Parser which is optimised for fast parsing. Error reporting@@ -107,16 +107,16 @@ {-# INLINE fail #-} instance Chunk k => ChunkParser k (Acceptor k) where- getPos = get $ \_ st -> Pos (_stLine st) (_stCol st)+ getPos = get $ \_ st -> Pos (_stLine st) (_stColumn st) {-# INLINE getPos #-} getFile = get $ \env _ -> _envFile env {-# INLINE getFile #-} - getRefPos = get $ \env _ -> Pos (_envRefLine env) (_envRefCol env)+ getRefPos = get $ \env _ -> Pos (_envRefLine env) (_envRefColumn env) {-# INLINE getRefPos #-} - withRefPos p = local (\st env -> env { _envRefLine = _stLine st, _envRefCol = _stCol st }) p+ withRefPos p = local (\st env -> env { _envRefLine = _stLine st, _envRefColumn = _stColumn st }) p {-# INLINE withRefPos #-} notFollowedBy p = Acceptor $ \env st ok err ->@@ -152,31 +152,31 @@ recover p _ = p {-# INLINE recover #-} - element e = Acceptor $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ element e = Acceptor $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if | _stOff < _envEnd env, (e', w) <- elementAt @k (_envBuf env) _stOff, e == e',- pos <- elementPos @k e (Pos _stLine _stCol) ->- ok e st { _stOff = _stOff + w, _stLine = _posLine pos, _stCol = _posColumn pos }+ pos <- elementPos @k e (Pos _stLine _stColumn) ->+ ok e st { _stOff = _stOff + w, _stLine = _posLine pos, _stColumn = _posColumn pos } | otherwise -> err $ ECombinator "element" {-# INLINE element #-} - elementScan f = Acceptor $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ elementScan f = Acceptor $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if | _stOff < _envEnd env, (e, w) <- elementAt @k (_envBuf env) _stOff, Just r <- f e,- pos <- elementPos @k e (Pos _stLine _stCol) ->- ok r st { _stOff = _stOff + w, _stLine = _posLine pos, _stCol = _posColumn pos }+ pos <- elementPos @k e (Pos _stLine _stColumn) ->+ ok r st { _stOff = _stOff + w, _stLine = _posLine pos, _stColumn = _posColumn pos } | otherwise -> err $ ECombinator "elementScan" {-# INLINE elementScan #-} - chunk k = Acceptor $ \env st@State{_stOff,_stCol} ok err ->+ chunk k = Acceptor $ \env st@State{_stOff,_stColumn} ok err -> let n = chunkWidth @k k in if n + _stOff <= _envEnd env && chunkEqual @k (_envBuf env) _stOff k then- ok k st { _stOff = _stOff + n, _stCol = _stCol + n }+ ok k st { _stOff = _stOff + n, _stColumn = _stColumn + n } else err $ ECombinator "chunk" {-# INLINE chunk #-}@@ -190,14 +190,14 @@ {-# INLINE asChunk #-} instance CharChunk k => CharParser k (Acceptor k) where- scan f = Acceptor $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ scan f = Acceptor $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if | (c, w) <- charAt @k (_envBuf env) _stOff, c /= '\0', Just r <- f c -> ok r st { _stOff = _stOff + w , _stLine = if c == '\n' then _stLine + 1 else _stLine- , _stCol = if c == '\n' then 1 else _stCol + 1+ , _stColumn = if c == '\n' then 1 else _stColumn + 1 } | otherwise -> err $ ECombinator "scan"@@ -208,18 +208,18 @@ char '\0' = error "Character '\\0' cannot be parsed because it is used as sentinel" char c | w <- charWidth @k c =- Acceptor $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ Acceptor $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if charAtFixed @k w (_envBuf env) _stOff == c then ok c st { _stOff = _stOff + w , _stLine = if c == '\n' then _stLine + 1 else _stLine- , _stCol = if c == '\n' then 1 else _stCol + 1+ , _stColumn = if c == '\n' then 1 else _stColumn + 1 } else err $ ECombinator "char" {-# INLINE char #-} - asciiScan f = Acceptor $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ asciiScan f = Acceptor $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if | b <- byteAt @k (_envBuf env) _stOff, b /= 0, b < 128,@@ -227,7 +227,7 @@ ok x st { _stOff = _stOff + 1 , _stLine = if b == asc_newline then _stLine + 1 else _stLine- , _stCol = if b == asc_newline then 1 else _stCol + 1+ , _stColumn = if b == asc_newline then 1 else _stColumn + 1 } | otherwise -> err $ ECombinator "asciiScan"@@ -236,12 +236,12 @@ asciiByte 0 = error "Character '\\0' cannot be parsed because it is used as sentinel" asciiByte b | b >= 128 = error "Not an ASCII character"- | otherwise = Acceptor $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ | otherwise = Acceptor $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if byteAt @k (_envBuf env) _stOff == b then ok b st { _stOff = _stOff + 1 , _stLine = if b == asc_newline then _stLine + 1 else _stLine- , _stCol = if b == asc_newline then 1 else _stCol + 1+ , _stColumn = if b == asc_newline then 1 else _stColumn + 1 } else err $ ECombinator "asciiByte"@@ -275,12 +275,12 @@ , _envFile , _envEnd , _envRefLine = 1- , _envRefCol = 1+ , _envRefColumn = 1 } initialState :: Int -> State initialState _stOff = State { _stOff , _stLine = 1- , _stCol = 1+ , _stColumn = 1 }
src/Text/PariPari/Internal/Class.hs view
@@ -64,13 +64,20 @@ -- | Parser which succeeds at the end of file eof :: p () - -- | Annotate the given parser with a label- -- used for error reporting+ -- | Annotate the given parser with a label used for error reporting.+ --+ -- __Note__: This function has zero cost in the 'Acceptor'. You can+ -- use it to improve the error reports without slowing+ -- down the fast path of your parser. label :: String -> p a -> p a -- | Hide errors occurring within the given parser -- from the error report. Based on the given -- labels an 'Error' is constructed instead.+ --+ -- __Note__: This function has zero cost in the 'Acceptor'. You can+ -- use it to improve the error reports without slowing+ -- down the fast path of your parser. hidden :: p a -> p a -- | Commit to the given branch, increasing@@ -82,9 +89,13 @@ -- libraries, which decreases the error priority -- within the given branch (and usually also influences backtracking). --- -- __Note__: `commit` only applies to the reported+ -- `commit` only applies to the reported -- errors, it has no effect on the backtracking behavior -- of the parser.+ --+ -- __Note__: This function has zero cost in the 'Acceptor'. You can+ -- use it to improve the error reports without slowing+ -- down the fast path of your parser. commit :: p a -> p a -- | Parse with error recovery.@@ -95,6 +106,10 @@ -- parser are ignored in any case. -- Error recovery support is only available -- in the 'Reporter' instance.+ --+ -- __Note__: This function has zero cost in the 'Acceptor'. You can+ -- use it to improve the error reports without slowing+ -- down the fast path of your parser. recover :: p a -> p a -> p a -- | Parse a single element
src/Text/PariPari/Internal/ElementCombinators.hs view
@@ -108,7 +108,7 @@ type Span = (Pos, Pos) --- | Decoreate the parser result with the position span+-- | Decorate the parser result with the position span withSpan :: ChunkParser k p => p a -> p (Span, a) withSpan p = do begin <- getPos
src/Text/PariPari/Internal/Reporter.hs view
@@ -50,29 +50,29 @@ data Report = Report { _reportFile :: !FilePath , _reportLine :: !Int- , _reportCol :: !Int+ , _reportColumn :: !Int , _reportErrors :: [ErrorContext] } deriving (Eq, Show, Generic) data Env k = Env- { _envBuf :: !(Buffer k)- , _envEnd :: !Int- , _envFile :: !FilePath- , _envOptions :: !ReportOptions- , _envHidden :: !Bool- , _envCommit :: !Int- , _envContext :: [String]- , _envRefLine :: !Int- , _envRefCol :: !Int+ { _envBuf :: !(Buffer k)+ , _envEnd :: !Int+ , _envFile :: !FilePath+ , _envOptions :: !ReportOptions+ , _envHidden :: !Bool+ , _envCommit :: !Int+ , _envContext :: [String]+ , _envRefLine :: !Int+ , _envRefColumn :: !Int } data State = State { _stOff :: !Int , _stLine :: !Int- , _stCol :: !Int+ , _stColumn :: !Int , _stErrOff :: !Int , _stErrLine :: !Int- , _stErrCol :: !Int+ , _stErrColumn :: !Int , _stErrCommit :: !Int , _stErrors :: [ErrorContext] , _stReports :: [Report]@@ -151,16 +151,16 @@ {-# INLINE fail #-} instance Chunk k => ChunkParser k (Reporter k) where- getPos = get $ \_ st -> Pos (_stLine st) (_stCol st)+ getPos = get $ \_ st -> Pos (_stLine st) (_stColumn st) {-# INLINE getPos #-} getFile = get $ \env _ -> _envFile env {-# INLINE getFile #-} - getRefPos = get $ \env _ -> Pos (_envRefLine env) (_envRefCol env)+ getRefPos = get $ \env _ -> Pos (_envRefLine env) (_envRefColumn env) {-# INLINE getRefPos #-} - withRefPos p = local (\st env -> env { _envRefLine = _stLine st, _envRefCol = _stCol st }) p+ withRefPos p = local (\st env -> env { _envRefLine = _stLine st, _envRefColumn = _stColumn st }) p {-# INLINE withRefPos #-} label l p = local (const $ addLabel l) p@@ -200,33 +200,33 @@ in unReporter p env st ok err1 {-# INLINE recover #-} - element e = Reporter $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ element e = Reporter $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if | _stOff < _envEnd env, (e', w) <- elementAt @k (_envBuf env) _stOff, e == e',- pos <- elementPos @k e (Pos _stLine _stCol) ->- ok e st { _stOff =_stOff + w, _stLine = _posLine pos, _stCol = _posColumn pos }+ pos <- elementPos @k e (Pos _stLine _stColumn) ->+ ok e st { _stOff =_stOff + w, _stLine = _posLine pos, _stColumn = _posColumn pos } | otherwise -> raiseError env st err $ EExpected [showElement @k e] {-# INLINE element #-} - elementScan f = Reporter $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ elementScan f = Reporter $ \env st@State{_stOff, _stLine, _stColumn} ok err -> let (e, w) = elementAt @k (_envBuf env) _stOff in if | _stOff >= _envEnd env -> raiseError env st err unexpectedEnd | _stOff < _envEnd env, Just r <- f e,- pos <- elementPos @k e (Pos _stLine _stCol) ->- ok r st { _stOff =_stOff + w, _stLine = _posLine pos, _stCol = _posColumn pos }+ pos <- elementPos @k e (Pos _stLine _stColumn) ->+ ok r st { _stOff =_stOff + w, _stLine = _posLine pos, _stColumn = _posColumn pos } | otherwise -> raiseError env st err $ EUnexpected $ showElement @k e {-# INLINE elementScan #-} - chunk k = Reporter $ \env st@State{_stOff,_stCol} ok err ->+ chunk k = Reporter $ \env st@State{_stOff,_stColumn} ok err -> let n = chunkWidth @k k in if n + _stOff <= _envEnd env && chunkEqual @k (_envBuf env) _stOff k then- ok k st { _stOff = _stOff + n, _stCol = _stCol + n }+ ok k st { _stOff = _stOff + n, _stColumn = _stColumn + n } else raiseError env st err $ EExpected [showChunk @k k] {-# INLINE chunk #-}@@ -240,7 +240,7 @@ {-# INLINE asChunk #-} instance CharChunk k => CharParser k (Reporter k) where- scan f = Reporter $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ scan f = Reporter $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if | (c, w) <- charAt @k (_envBuf env) _stOff, c /= '\0' -> case f c of@@ -248,7 +248,7 @@ ok r st { _stOff = _stOff + w , _stLine = if c == '\n' then _stLine + 1 else _stLine- , _stCol = if c == '\n' then 1 else _stCol + 1+ , _stColumn = if c == '\n' then 1 else _stColumn + 1 } Nothing -> raiseError env st err $ EUnexpected $ show c@@ -263,18 +263,18 @@ char '\0' = error "Character '\\0' cannot be parsed because it is used as sentinel" char c | w <- charWidth @k c =- Reporter $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ Reporter $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if charAtFixed @k w (_envBuf env) _stOff == c then ok c st { _stOff = _stOff + w , _stLine = if c == '\n' then _stLine + 1 else _stLine- , _stCol = if c == '\n' then 1 else _stCol + 1+ , _stColumn = if c == '\n' then 1 else _stColumn + 1 } else raiseError env st err $ EExpected [show c] {-# INLINE char #-} - asciiScan f = Reporter $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ asciiScan f = Reporter $ \env st@State{_stOff, _stLine, _stColumn} ok err -> let b = byteAt @k (_envBuf env) _stOff in if | b /= 0, b < 128,@@ -282,7 +282,7 @@ ok x st { _stOff = _stOff + 1 , _stLine = if b == asc_newline then _stLine + 1 else _stLine- , _stCol = if b == asc_newline then 1 else _stCol + 1+ , _stColumn = if b == asc_newline then 1 else _stColumn + 1 } | _stOff >= _envEnd env -> raiseError env st err unexpectedEnd@@ -293,12 +293,12 @@ asciiByte 0 = error "Character '\\0' cannot be parsed because it is used as sentinel" asciiByte b | b >= 128 = error "Not an ASCII character"- | otherwise = Reporter $ \env st@State{_stOff, _stLine, _stCol} ok err ->+ | otherwise = Reporter $ \env st@State{_stOff, _stLine, _stColumn} ok err -> if byteAt @k (_envBuf env) _stOff == b then ok b st { _stOff = _stOff + 1 , _stLine = if b == asc_newline then _stLine + 1 else _stLine- , _stCol = if b == asc_newline then 1 else _stCol + 1+ , _stColumn = if b == asc_newline then 1 else _stColumn + 1 } else raiseError env st err $ EExpected [showByte b]@@ -340,7 +340,7 @@ st { _stErrors = [e'] , _stErrOff = _stOff st , _stErrLine = _stLine st- , _stErrCol = _stCol st+ , _stErrColumn = _stColumn st , _stErrCommit = _envCommit env } | _stOff st == _stErrOff st && _envCommit env == _stErrCommit st,@@ -363,7 +363,7 @@ s { _stErrors = _stErrors s' , _stErrOff = _stErrOff s' , _stErrLine = _stErrLine s'- , _stErrCol = _stErrCol s'+ , _stErrColumn = _stErrColumn s' , _stErrCommit = _stErrCommit s' } | _stErrOff s' == _stErrOff s && _stErrCommit s' == _stErrCommit s =@@ -414,13 +414,13 @@ -- | Run 'Reporter' on the given chunk, returning the result -- if successful and reports from error recoveries.--- In the case of an error, 'Nothing' is returned and the 'report' list+-- In the case of an error, 'Nothing' is returned and the 'Report' list -- is non-empty. runReporter :: Chunk k => Reporter k a -> FilePath -> k -> (Maybe a, [Report]) runReporter = runReporterWithOptions defaultReportOptions addReport :: Env k -> State -> State-addReport e s = s { _stReports = Report (_envFile e) (_stErrLine s) (_stErrCol s) (_stErrors s) : _stReports s }+addReport e s = s { _stReports = Report (_envFile e) (_stErrLine s) (_stErrColumn s) (_stErrors s) : _stReports s } initialEnv :: ReportOptions -> FilePath -> Buffer k -> Int -> Env k initialEnv _envOptions _envFile _envBuf _envEnd = Env@@ -428,21 +428,21 @@ , _envBuf , _envOptions , _envEnd- , _envContext = []- , _envHidden = False- , _envCommit = 0- , _envRefLine = 1- , _envRefCol = 1+ , _envContext = []+ , _envHidden = False+ , _envCommit = 0+ , _envRefLine = 1+ , _envRefColumn = 1 } initialState :: Int -> State initialState _stOff = State { _stOff , _stLine = 1- , _stCol = 1+ , _stColumn = 1 , _stErrOff = 0 , _stErrLine = 0- , _stErrCol = 0+ , _stErrColumn = 0 , _stErrCommit = 0 , _stErrors = [] , _stReports = []@@ -453,7 +453,7 @@ showReport r = "Parser errors at " <> _reportFile r <> ", line " <> show (_reportLine r)- <> ", column " <> show (_reportCol r)+ <> ", column " <> show (_reportColumn r) <> "\n\n" <> showErrors (_reportErrors r) -- | Pretty string representation of '[ErrorContext]'.
src/Text/PariPari/Internal/Tracer.hs view
@@ -34,13 +34,15 @@ next = unReporter (unTracer p2) env (mergeErrorState env st s) ok err in if width > 1 then trace ("Backtracking " <> show width <> " bytes at line " <> show (_stLine s)- <> ", column " <> show (_stCol s) <> ", context " <> show (_envContext env) <> ": "+ <> ", column " <> show (_stColumn s) <> ", context " <> show (_envContext env) <> ": " <> showChunk (packChunk @k (_envBuf env) (_stOff st) width)) next else next in unReporter (unTracer p1) env st ok err' --- | Run 'Tracer' on the given chunk, returning either--- an error 'Report' or, if successful, the result.+-- | Run 'Tracer' on the given chunk, returning the result+-- if successful and reports from error recoveries.+-- In the case of an error, 'Nothing' is returned and the 'Report' list+-- is non-empty. runTracer :: Chunk k => Tracer k a -> FilePath -> k -> (Maybe a, [Report]) runTracer = runReporter . unTracer
+ src/Text/PariPari/Lens.hs view
@@ -0,0 +1,64 @@+{-# LANGUAGE Rank2Types #-}+module Text.PariPari.Lens (+ posLine+ , posColumn+ , reportLine+ , reportColumn+ , reportFile+ , reportErrors+ , ecErrors+ , ecContext+ , optMaxContexts+ , optMaxErrorsPerContext+ , optMaxLabelsPerContext+) where++import Text.PariPari.Internal.Chunk+import Text.PariPari.Internal.Class+import Text.PariPari.Internal.Reporter++type Lens a b = forall f . Functor f => (b -> f b) -> (a -> f a)++posLine :: Lens Pos Int+posLine k p = fmap (\x -> p { _posLine = x }) (k (_posLine p))+{-# INLINE posLine #-}++posColumn :: Lens Pos Int+posColumn k p = fmap (\x -> p { _posColumn = x }) (k (_posColumn p))+{-# INLINE posColumn #-}++reportLine :: Lens Report Int+reportLine k r = fmap (\x -> r { _reportLine = x }) (k (_reportLine r))+{-# INLINE reportLine #-}++reportColumn :: Lens Report Int+reportColumn k r = fmap (\x -> r { _reportColumn = x }) (k (_reportColumn r))+{-# INLINE reportColumn #-}++reportFile :: Lens Report FilePath+reportFile k r = fmap (\x -> r { _reportFile = x }) (k (_reportFile r))+{-# INLINE reportFile #-}++reportErrors :: Lens Report [ErrorContext]+reportErrors k r = fmap (\x -> r { _reportErrors = x }) (k (_reportErrors r))+{-# INLINE reportErrors #-}++ecErrors :: Lens ErrorContext [Error]+ecErrors k e = fmap (\x -> e { _ecErrors = x }) (k (_ecErrors e))+{-# INLINE ecErrors #-}++ecContext :: Lens ErrorContext [String]+ecContext k e = fmap (\x -> e { _ecContext = x }) (k (_ecContext e))+{-# INLINE ecContext #-}++optMaxContexts :: Lens ReportOptions Int+optMaxContexts k o = fmap (\x -> o { _optMaxContexts = x }) (k (_optMaxContexts o))+{-# INLINE optMaxContexts #-}++optMaxErrorsPerContext :: Lens ReportOptions Int+optMaxErrorsPerContext k o = fmap (\x -> o { _optMaxErrorsPerContext = x }) (k (_optMaxErrorsPerContext o))+{-# INLINE optMaxErrorsPerContext #-}++optMaxLabelsPerContext :: Lens ReportOptions Int+optMaxLabelsPerContext k o = fmap (\x -> o { _optMaxLabelsPerContext = x }) (k (_optMaxLabelsPerContext o))+{-# INLINE optMaxLabelsPerContext #-}