[m-rev.] for review: one_or_more and one_or_more_map
jfischer at opturion.com
Fri Feb 28 11:21:03 AEDT 2020
On Fri, 28 Feb 2020, Zoltan Somogyi wrote:
> For review by Julien (thanks for the review for my previous diff).
> I would particularly like you to check the change to NEWS,
> especially the markup.
> Add the one_or_more and one_or_more_map modules to the library.
> diff --git a/NEWS b/NEWS
> index 6f44099be..1f98a7d46 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,6 +1,16 @@
> NEWS since Mercury 20.01.x
> +Changes that may break compatibility
> +* We have deleted the one_or_more type, and the operations on it, from
Names of Mercury entities such as types, predicates, modules etc should be quoted,
e.g. `one_or_more` here.
+ the `list` module of the Mercury standard library, and moved them to
> + a new module named `one_or_more`. This will break compatibility for
> + code that used the moved functionality, but such breaks can be fixed
> + simply by importing `one_or_more` as well as (or in rare cases, instead of)
> + the `list` module.
> Changes to the Mercury standard library
> @@ -15,6 +25,21 @@ Changes to the Mercury standard library
> kv_lists are not standard lists, and thus cannot be manipulated
> using the functions and predicates of the `list` module.
> +### New module: `one_or_more` module
> +* This module defines the one_or_more type, which represents nonempty lists,
> + and provides operations on the values of this type. For every operation
> + in the `list` module that makes sense for nonempty lists, there is a
> + corresponding operation in `one_or_more`.
> +### New module: `one_or_more_map` module
> +* This module implements a map from keys to one or more values.
> + Its functionality is very similar to that of the `multi_map` module
> + (in fact, the two modules define the exact same set of operations),
> + but unlike `multi_map`, it uses the type system to enforce the invariant
> + that every key in the map must have at least one associated value.
> ### New module: `thread.closeable_channel` module
> * This module implements closeable unbounded channels, similar to the unbounded
> @@ -75,6 +100,16 @@ Changes to the Mercury standard library
> - pred `map_corresponding3/5`
> +* The following type, predicates and functions have been moved to the
> + new `one_or_more` module. Note: this change can break backwards
> + compatibility.
> + - type `one_or_more/1`
> + - func `one_or_more_cons/2` (as one_or_more.cons/2)
Quote the replacement function name and arity as well.
> + - func `one_or_more_to_list/1`
> + - pred `list_to_one_or_more/2`
> + - pred `det_list_to_one_or_more/2`
The rest of the diff looks fine.
More information about the reviews