guarantee list sorting in type
matthewleon opened this issue · 3 comments
matthewleon commented
The insert function could accept a SortedList, whose constructor guarantees sorting, in its type signature. This could perhaps be accompanied by an unsafe constructor for creating a SortedList in contexts in which one is confident that the list is sorted.
matthewleon commented
Would probably actually also be useful for the type to keep track of the comparison function, allowing insertion into a SortedList to maintain the same type.
matthewleon commented
Will create a separate repo that tries to add this kind of thing as a separate library.
garyb commented
Linking the repo here for future reference: https://github.com/matthewleon/purescript-ordered-lists 😄