janestreet / base

Standard library for OCaml
MIT License
848 stars 124 forks source link

Support for non-empty lists #141

Open johnyob opened 1 year ago

johnyob commented 1 year ago

It would be great if Base provided a List.Non_empty module for non-empty lists

type 'a t = (::) of 'a * 'a list
bcc32 commented 1 year ago

Does the Nonempty_list library do what you need? You can get it by installing core_kernel and using core_kernel.nonempty_list in your dune file.

johnyob commented 1 year ago

I was unaware of this Nonempty_list library in Core_kernel.

Nonetheless, it was my understanding that Core_kernel was going to be deprecated at some point. Will this Nonempty_list library be merged into Base or Core?

bcc32 commented 1 year ago

Core_kernel the library has been deprecated, but the opam package still remains. We're not planning on merging Nonempty_list into Base or Core anytime soon, but it's possible the best way to handle this is to release it as a separate, one-module package, rather than bundling it with a bunch of unrelated libraries.

I think @staronj or maybe @tov is the right person to think about this (low confidence)?

tov commented 1 year ago

That sounds fine to me (low confidence), but I'm wondering if there's a reason not to move it to core.