3 ms·
> I actually mean the approach where you explicitly pick a "sort" implementation that would yield a linear-time smallest-element when evaluated lazily Agreed.
by tome 9y ago
> I actually mean the approach where you explicitly pick a "sort" implementation that would yield a linear-time smallest-element when evaluated lazily
Agreed. It's quite painful to see Haskell advocates sharing this example. It's far too clever and lacks robustness. It's a cute triviality, not an example of what the language is actually good for.
> I don't know if a popular sort with this property exists
Well yes, Haskell's sort function has this property. It's a merge sort.
> If you want the smallest element, get the smallest element by scanning the list. No big deal.
Yes, or just use the built in min function.
> I have seen way too many advocating that makes it seem like this vague idea of "safety by type-safety" is the only issue that comes up in software development.
It's a shame you seen too many advocating that, because that's not all that Haskell's good for. It's also good for
> modularity, efficiency, portability, ..., development speed
(not "compiling speed"! :) )