caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Late adding of type variable constraints
@ 2015-09-04 20:28 Markus Mottl
  2015-09-04 22:19 ` Jacques Garrigue
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Mottl @ 2015-09-04 20:28 UTC (permalink / raw)
  To: OCaml List

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-11 16:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 20:28 [Caml-list] Late adding of type variable constraints Markus Mottl
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).