-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Basically every operation in this library is not very smartly implemented in terms of reducing compile times (e.g. sorting an already sorted list!). Fix this.
- Don't re-sort on every insertion, but insert at the right place [Is O(n * log n), could be O (log n)]
-
delete(and thereforesetandmodify) resort the map after deletion, when in fact it is already sorted. It may be hard to convince GHC that is already is sorted, though. In any case,submapprobably shouldn't be used - we always want to remove just one element. -
Settablehas a constraint (new ~ Map.AsMap...) to prove something in a costly way that we should already know is true.
In general, I think the right approach is not prove to the compiler that certain operations maintain the set properties, and only have those operations accept sets, but instead just assume the arguments are sets and recover safety by not exposing a way of creating a Book' that doesn't have those properties.
Another interesting possibility is seeing if we can use Data.Type.Equality and unsafeCoerce to have the same type equalities for cheaper.
Wizek
Metadata
Metadata
Assignees
Labels
No labels