
4 Jun
2021
4 Jun
'21
4:57 p.m.
On Fri, 4 Jun 2021, Henrik Nilsson wrote:
And besides those, there are other perfectly reasonable functions like (!!) and foldr1 that I'd definitely would not say never should be used, just as I would not say that array indexing or integer divisions must be shunned because they are partial.
I prefer to replace (xs!!k) by case drop k xs of [] -> defaultX x:_ -> x or do not use indexing on lists, at all, because of performance reasons. I use foldr1 only on non-empty lists. Division by non-zero divisors would be nice to have, but currently we can only have it with Liquid Haskell.