mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-12-01 10:54:14 +03:00
don't create hints for errors without messages
This commit is contained in:
parent
49e80775ef
commit
89f34688ab
@ -163,8 +163,9 @@ newtype Hints = Hints [[String]] deriving Monoid
|
|||||||
-- | Convert 'ParseError' record into 'Hints'.
|
-- | Convert 'ParseError' record into 'Hints'.
|
||||||
|
|
||||||
toHints :: ParseError -> Hints
|
toHints :: ParseError -> Hints
|
||||||
toHints err = Hints [messageString <$> msgs]
|
toHints err = Hints hints
|
||||||
where msgs = filter ((== 1) . fromEnum) $ errorMessages err
|
where hints = if null msgs then [] else [messageString <$> msgs]
|
||||||
|
msgs = filter ((== 1) . fromEnum) $ errorMessages err
|
||||||
|
|
||||||
-- | @withHints hs c@ makes “error” continuation @c@ use given hints @hs@.
|
-- | @withHints hs c@ makes “error” continuation @c@ use given hints @hs@.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user