AndrasKovacs/flatparse

`posLineCols` fails for more than one `Pos`

TheMatten opened this issue · 1 comments

posLineCols fails with

*** Exception: FlatParse.Basic.posLineCols: invalid position

on any input with more than one Pos - problem seems to be with initial sorting assuming increasing, not decreasing values of Pos:

sorted = sortBy (comparing snd) (zip [0..] poss)

Instead, it should probably sort the opposite way, e.g. with Down:

sorted = sortOn (Down . snd) (zip [0..] poss)

and such modified function seems to work fine on some test inputs.

Fixed by ba96008. I also updated on Hackage.