Skip to content

Commit fc4ee44

Browse files
committed
Derive Eq instance for ParseError
1 parent 9e0d291 commit fc4ee44

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Text/Parsing/Parser.purs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import Text.Parsing.Parser.Pos (Position, initialPos)
1515
-- | A parsing error, consisting of a message and position information.
1616
data ParseError = ParseError String Position
1717

18+
derive instance eqParseError :: Eq ParseError
19+
1820
-- | The result of a single parse
1921
data Result s a = Result s -- the new input
2022
(Either ParseError a) -- the result
@@ -24,9 +26,6 @@ data Result s a = Result s -- the new input
2426
instance showParseError :: Show ParseError where
2527
show (ParseError msg pos) = "ParseError " <> show msg <> " " <> show pos
2628

27-
instance eqParseError :: Eq ParseError where
28-
eq (ParseError m1 p1) (ParseError m2 p2) = m1 == m2 && p1 == p2
29-
3029
-- | `PState` contains the remaining input and current position.
3130
data PState s = PState s Position
3231

0 commit comments

Comments
 (0)