We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5add8b commit 7b8ea03Copy full SHA for 7b8ea03
src/Text/Parsec/Pos.hs
@@ -41,7 +41,12 @@ type Column = Int
41
-- 'Ord' class.
42
43
data SourcePos = SourcePos SourceName !Line !Column
44
- deriving ( Eq, Ord, Data, Typeable)
+ deriving (Eq, Data, Typeable)
45
+
46
+-- | The ordering compares first by line, column, then by sourcename.
47
+instance Ord SourcePos where
48
+ compare (SourcePos snA lnA colA) (SourcePos snB lnB colB)
49
+ = lnA `compare` lnB <> colA `compare` colB <> snA `compare` snB
50
51
-- | Create a new 'SourcePos' with the given source name,
52
-- line number and column number.
0 commit comments