sortWith
The
sortWith function sorts a list of elements using the user
supplied function to project something out of each element
In general if the user supplied function is expensive to compute then
you should probably be using
sortOn, as it only needs to
compute it once for each element.
sortWith, on the other hand
must compute the mapping function for every comparison that it
performs.
Dependency sort a STG program, and annotate it with free variables The
returned bindings: * Are in dependency order * Each StgRhsClosure is
correctly annotated (in its extension field) with the free variables
needed in the closure * Each StgCase is correctly annotated (in its
extension field) with the variables that must be saved across the case