Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Andres Varon <avaron@gmail.com>
To: skaller <skaller@users.sourceforge.net>
Cc: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Polymorphic variants question
Date: Fri, 1 Sep 2006 16:49:39 -0400	[thread overview]
Message-ID: <7E1CAC5D-67CC-4A5C-8DE6-BB2A60A6615B@gmail.com> (raw)
In-Reply-To: <1157138993.22787.34.camel@rosella.wigram>

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]


On Sep 1, 2006, at 3:29 PM, skaller wrote:

>
> let string_of_term dfns term = match term with
>   | #qualified_name_t as x -> string_of_qualified_name x

This is, indeed, a practical reason why PM are so nice. In the same  
line of ideas, I wish I could do something like the following :

module type S = sig
	type t
	val f : t -> int
end

module A (B : S with type t = [> ]) (C : S with type t = [> ]) : S  
with type t = [B.t | C.t] = struct
	type t = [ B.t | C.t ]	

	let f x =
		match x with
		| #A.t  as x -> A.f x	
		| #B.t as x -> B.f x
end

Of course the example won't even compile, but I think it reflects the  
spirit of what I would like to do. I know this is just not possible  
due to a practical reason (#A.t is expanded to the constructors that  
it includes, and therefore, A.t has to be fully known at compile  
time, correct?). Is there a theoretical reason to have this  
constraint though?

Andres


[-- Attachment #2: Type: text/html, Size: 2471 bytes --]

  reply	other threads:[~2006-09-01 20:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-01 17:31 David Allsopp
2006-09-01 18:33 ` Chris King
2006-09-01 19:00   ` [Caml-list] " skaller
2006-09-01 19:57     ` David Allsopp
2006-09-01 20:40       ` Jacques Carette
2006-09-01 18:40 ` [Caml-list] " Olivier Andrieu
2006-09-01 19:26 ` Jon Harrop
2006-09-01 19:29 ` skaller
2006-09-01 20:49   ` Andres Varon [this message]
2006-09-02 11:16     ` Jacques Garrigue
2006-09-03  1:22       ` Andres Varon
2006-09-03  9:08         ` Jacques Garrigue
2006-09-03 15:00           ` Andres Varon
2006-09-03 23:18             ` Jacques Garrigue
2006-09-03  0:48   ` [Caml-list] Polymorphic variants problem skaller
2006-09-03  1:12     ` Andres Varon
  -- strict thread matches above, loose matches on Subject: below --
2001-07-20  1:05 [Caml-list] polymorphic variants question John Max Skaller

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=7E1CAC5D-67CC-4A5C-8DE6-BB2A60A6615B@gmail.com \
    --to=avaron@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /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