From: Markus Elfring <Markus.Elfring@web.de>
To: Matthew Ryan <matthew@o1labs.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Documentation challenges for the application of comparison functions
Date: Mon, 4 Jan 2021 17:33:18 +0100 [thread overview]
Message-ID: <1c590ac8-a4ce-bae8-fce4-cc12ef7fc172@web.de> (raw)
In-Reply-To: <CAHsMTAEdTrvBhGYLst8gfXoqYqzFoVyZ-URiYjukoGeUu-Xo1w@mail.gmail.com>
> It's not equivalent per se, since you lose the flexibility to call the function with e.g.
>
> let find_float_int ~(cmp : float -> int -> int) (index : float) (map : (int, 'c)) =
> find ~cmp index map;;
I guess that there is the detail to reconsider if comparisons should be performed
with different data types (which corresponding to special properties of
such a programming interface).
> where 'a = float and 'b = int. However, it is valid
Thanks for such a view.
> -- and arguably describes the function's contract better -- to narrow the function's type by combining the type variables:
I would interpret involved aspects in further directions.
> let find : cmp:('a -> 'a -> int) -> 'a -> ('a, 'b) t = find;;
The elements of a data container like “Map” should usually refer to the same data type,
shouldn't they?
I am curious then under which circumstances a type like “Comparable” can be applied instead.
Will any “…able” types become more popular?
Regards,
Markus
prev parent reply other threads:[~2021-01-04 16:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-02 15:42 Markus Elfring
[not found] ` <CAHsMTAGtTZ7KaSfUqmPJf6bBmX6uD4==x5U3De66EA7Woq4Hhg@mail.gmail.com>
[not found] ` <9315a69b-5512-7968-2804-785add2d14ea@web.de>
2021-01-04 12:43 ` Matthew Ryan
2021-01-04 16:33 ` Markus Elfring
2021-01-04 16:33 ` Markus Elfring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c590ac8-a4ce-bae8-fce4-cc12ef7fc172@web.de \
--to=markus.elfring@web.de \
--cc=caml-list@inria.fr \
--cc=matthew@o1labs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox