Claus Reinke wrote:
[trac seems unreachable at the moment, hence good old email]

while trying to write a test for an extension of :browse, i encountered
an issue with the existing functionality: the order of names is not stable,
making it difficult to write meaningful tests for :browse.
a reduced test case & output are appended below, showing that
output order is affected by prior usage, in both 6.6.1 and HEAD.

Yes, I noticed this too.

i would prefer for the items to appear in source order, but at the
point :browse gets a hand on them, source location information
might not be available; sorting by Name would be random due to
uniqueIds, and lexicographic sorting would be confusing to users
(spreading related items all over the alphabet, instead of keeping
the order in which they appear in source and documentation).
is there a way to keep the items in source order, within each
module (modules themselves could be sorted lexicographically)?

I think what we want differs depending on whether you're browsing the whole module (:browse *M) or just the exports (:browse M). In the former case, you want the source ordering, and we have that because the module was compiled in this session and all the Names will have source locations (GHC.nameSrcSpan). However, :browse *M gives you the entire top-level scope rather than just the local bindings, so we probably want to separate local from non-local entities and sort the non-local entities alphabetically.

In the second case, you want the export-list ordering, i.e. the same ordering that the entities occur in the Haddock documentation. Unfortunately this information isn't retained, so we'll have to settle for alphabetic sorting.

It would be great if you could implement this, or else just submit a ticket.

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to