From: Markus Mottl <markus.mottl@gmail.com>
To: OCaml List <caml-list@yquem.inria.fr>
Subject: [Caml-list] Late adding of type variable constraints
Date: Fri, 4 Sep 2015 16:28:47 -0400 [thread overview]
Message-ID: <CAP_800pEYkpDn9yXgnuCkdVjHND1yAvGPwcUsLD0mxq0NF9DJw@mail.gmail.com> (raw)
Hi,
I wonder whether there is a way to add constraints to type variables
in signatures after the signature was defined. E.g.:
---
module type S = sig
type 'a t
type ('a, 'b) mappers
val map : ('a, 'b) mappers -> 'a t -> 'b t
end
module type T = sig
type 'a t constraint 'a = unit (* whatever *)
include S with type 'a t := 'a t
end
---
The above will fail, because 'a has additional constraints for type
"t" in signature "T". If I write instead e.g. "type 'a t = 'a list",
this will work and also constrain the signature to something narrower.
What makes constraints on polymorphic variables special here?
Regards,
Markus
--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
next reply other threads:[~2015-09-04 20:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-04 20:28 Markus Mottl [this message]
2015-09-04 22:19 ` Jacques Garrigue
2015-09-04 23:58 ` Markus Mottl
2015-09-07 18:33 ` Mikhail Mandrykin
2015-09-09 14:00 ` Markus Mottl
2015-09-09 19:28 ` Mikhail Mandrykin
2015-09-11 15:56 ` Markus Mottl
2015-09-11 16:24 ` Mikhail Mandrykin
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=CAP_800pEYkpDn9yXgnuCkdVjHND1yAvGPwcUsLD0mxq0NF9DJw@mail.gmail.com \
--to=markus.mottl@gmail.com \
--cc=caml-list@yquem.inria.fr \
/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