ekmett / tables

Deprecated because of
https://github.com/ekmett/tables/issues/15
Other
78 stars 13 forks source link

Conversion to list is unsorted #16

Closed neko-kai closed 10 years ago

neko-kai commented 11 years ago

view (from table) returns unsorted list (sorted by primary key only?). Won't hurt to either fix this or add a toAscList function.

startling commented 11 years ago

It seems like view (from table) and toList (from Data.Foldable) both order things by the primary key. What other behavior are you expecting?

neko-kai commented 11 years ago

I expected them to be sorted by data's Ord, like a Set.

ekmett commented 11 years ago

The primary key is the order. If you stick things in any off the shelf database, it comes out ordered by primary key. If you want that order, just make the primary key be the whole table. And if you want to further constrain it, then add additional candidate keys to impart whatever other order you want on it.

Many of my uses of tables have functions in them. I can't put Ord on the table itself without giving up structural equality.