RFC: Add HasCallStack constraint to partial Data.List functions.

Henrik Nilsson Henrik.Nilsson at nottingham.ac.uk
Sat Jun 5 06:28:50 UTC 2021


On 06/04/2021 09:57 PM, Henning Thielemann wrote:
> 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

Entirely reasonable in many cases. Which does not make (!!) universally

Let developers, educators, and others make their own informed
choices and adopt their own informed policies depending on
their specific context and needs.



This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and

Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored 
where permitted by law.

More information about the Libraries mailing list