caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Constraints in module types
@ 2006-01-19 10:53 Alessandro Baretta
  2006-01-19 11:38 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Alessandro Baretta @ 2006-01-19 10:53 UTC (permalink / raw)
  To: Ocaml

# type foo = [ `Foo of foo ];;
type foo = [ `Foo of foo ]
# module type BAR = sig type bar constraint bar = [ > foo ] end;;
The type constraints are not consistent.
Type bar is not compatible with type [> foo ]

Is there a good reason for prohibiting the above declarations? Could I achieve a 
similar effect with private row types?

Alex


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

* Re: [Caml-list] Constraints in module types
  2006-01-19 10:53 Constraints in module types Alessandro Baretta
@ 2006-01-19 11:38 ` Jacques Garrigue
  2006-01-19 14:38   ` Alessandro Baretta
  0 siblings, 1 reply; 3+ messages in thread
From: Jacques Garrigue @ 2006-01-19 11:38 UTC (permalink / raw)
  To: a.baretta; +Cc: caml-list

From: Alessandro Baretta <a.baretta@barettadeit.com>

> # type foo = [ `Foo of foo ];;
> type foo = [ `Foo of foo ]
> # module type BAR = sig type bar constraint bar = [ > foo ] end;;
> The type constraints are not consistent.
> Type bar is not compatible with type [> foo ]
> 
> Is there a good reason for prohibiting the above declarations? Could I achieve a 
> similar effect with private row types?

Not a "similar" effect, as the meaning of the above code is: define an
abstract type bar, and check that this abstract type is unifiable with
[> foo] (by definition impossible, so this might just be a syntax
error...)

On the other hand

  module type BAR = sig type bar = private [> foo] end

means "require the type bar to be an instance of type [> foo]".
I suppose this is what you intended?

Jacques


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

* Re: [Caml-list] Constraints in module types
  2006-01-19 11:38 ` [Caml-list] " Jacques Garrigue
@ 2006-01-19 14:38   ` Alessandro Baretta
  0 siblings, 0 replies; 3+ messages in thread
From: Alessandro Baretta @ 2006-01-19 14:38 UTC (permalink / raw)
  To: Jacques Garrigue; +Cc: caml-list

Jacques Garrigue wrote:
> From: Alessandro Baretta <a.baretta@barettadeit.com>

> On the other hand
> 
>   module type BAR = sig type bar = private [> foo] end
> 
> means "require the type bar to be an instance of type [> foo]".
> I suppose this is what you intended?
> 
> Jacques

What a man! Thank you! This is exactly what I was trying to express.

Alex


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


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

end of thread, other threads:[~2006-01-19 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 10:53 Constraints in module types Alessandro Baretta
2006-01-19 11:38 ` [Caml-list] " Jacques Garrigue
2006-01-19 14:38   ` Alessandro Baretta

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).