A very simple suggestion for the programming style of
Prelude, Library ... :
to minimize the number of function names using options.
Thus, we see in ghc-0.26 library
quicksort :: (a -> a -> Bool) -> [a] -> [a]
sortLt :: (a -> a -> Bool) -> [a] -> [a]
stableSortLt :: (a -> a -> Bool) -> [a] -> [a]
I think, it should be like this:
sort :: String -> (a -> a -> Bool) -> [a] -> [a]
--mode
sort mode cp xs = (case mode of
"" -> quick xs
"lt" -> lt xs
"st" -> stable xs
_ -> error "(sort ..): wrong mode"
)
where quick xs =
...
lt xs =
...
stable xs =
...
This implies that if you recently have only one variant of `sort',
still introduce the mode String in the format, to preserve room
for the future versions - if they are likely to appear.
-----------------------------------------------------------------
However, I do not propose supplying a single function for all
functions of the same format !
Sergey Mechveliani [EMAIL PROTECTED]