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.
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.
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.
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.EqualityandunsafeCoerceto have the same type equalities for cheaper.