Proposal: Add NonEmpty constructors to the Prelude

Ganesh Sittampalam ganesh at earth.li
Thu Jan 5 22:07:03 UTC 2017


-1 : I'm against this because NonEmpty is a special case of "lists with
at least n elements", and n=1 doesn't feel like a particuar sweet spot.
Once people are using NonEmpty everywhere, won't they need at least 2
elements when using tail to get a NonEmpty, etc?

On the flip side, the "group" functions do provide some argument in
favour, as the n=1 case is exactly the guarantee they provide for their
output.

On 28/12/2016 19:39, Yitzchak Gale wrote:
> In continuation of Simon Jakobi's proposal for a small
> incremental change to the Prelude to make it more
> conducive to partial-function-free programming,
> 
> https://mail.haskell.org/pipermail/libraries/2016-December/027496.html
> 
> and after some encouragement from the community on reddit,
> I propose adding the basic constructors of NonEmpty to
> the Prelude: nonEmpty, (:|), and the type constructor NonEmpty.
> 
> In practice, users of NonEmpty will often still need a qualified
> import of Data.List.NonEmpty. But having the constructors
> available in the Prelude will make the use of NonEmpty more
> common, and will make programming without partial functions
> feel more natural and standard.
> 
> Note: This proposal is separate from Simon's and should not
> interfere with the acceptance of Simon's. But it is related in
> that it attempts to achieve the same goals.
> 
> Discussion period: Until the end of the discussion period of
> Simon's proposal.
> 
> Thanks,
> Yitz
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> 



More information about the Libraries mailing list