Proposal: Add singleton function to Data.List module

Henrik Nilsson Henrik.Nilsson at nottingham.ac.uk
Sun Aug 18 14:58:20 UTC 2019


Hi,

On 08/13/2019 11:56 PM, Herbert Valerio Riedel wrote:
> But we already have at least two monomorphic variants to express this
> with Haskell's concise native syntax and vocabulary which has by
> design a preferential treatment of lists (it was considered even more
> important than type-sigs so that we got the `:` cons operator for
> lists and the `::` for type-sig annotations) -- so let's not try to
> fight Haskell's core idioms by hiding them behind some trivial
> additional redundant synonyms! I still fail to see the actual
> *technical*  problem being solved by the original proposal asking to
> add yet another, wordy way to construct single-item-lists.

To me, the main argument for "singleton" is that of consistency with
other container types. But, on balance, I do agree with Herbert
and others: operator sections is a core Haskell idiom, and (:[]) is an 
age-old and obvious instance: even beginner Haskell programmers will be
very familiar with (:) for list construction, and along with the basic
arithmetic operators, it is definitely one of the operators most
familiar to Haskell programmers.

So -1 from me.

/Henrik




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
attachment. 

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