From: Dumitru Potop-Butucaru <dumitru.potop_butucaru@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Bug in the module system of version 3.12.0+beta1
Date: Thu, 22 Jul 2010 09:07:40 +0200 [thread overview]
Message-ID: <4C47EE3C.2010908@inria.fr> (raw)
In-Reply-To: <9454F06C-C286-4A1F-8A9F-CA3B27F8E3BB@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3373 bytes --]
Ok, I got it.
Thank you all for the help,
Jacky
On 22/07/2010 08:47, Jacques Garrigue wrote:
> No, I'm saying that this kind of syntax overloading occurs in Haskell.
> However, since Haskell has no functors, you cannot do that either.
>
> Again, what you ask for is possible in ocaml, and in a particularly clean
> way in 3.12. Namely, Jeremy Yallop's second example does exactly what you want.
> The only difference is the syntax: you write "ABC with module M := IntList"
> rather than "ABC(IntList)". Different concepts get different syntax.
>
> Jacques
>
> On 2010/07/22, at 15:38, Dumitru Potop-Butucaru wrote:
>
>
>> So, what you say is that this way of manipulating
>> module types can be done in Haskell?
>>
>> Yours,
>> Jacky
>>
>>
>> On 22/07/2010 08:18, Jacques Garrigue wrote:
>>
>>> From: Dumitru Potop-Butucaru<dumitru.potop_butucaru@inria.fr>
>>>
>>>
>>>> However, I still did not understand this statement of
>>>> Jeremy Yallop:
>>>>
>>>>
>>>>>> module type Abc =
>>>>>> functor (M:Simple) ->
>>>>>> sig
>>>>>> val x : M.t
>>>>>> end
>>>>>>
>>>>>>
>>>>>>
>>>>> You're trying to treat Abc as a functor from signatures to signatures
>>>>> (i.e. as a parameterised signature). In fact, it's something quite
>>>>> different: it's the *type* of a functor from structures to structures.
>>>>>
>>>>>
>>>>>
>>>> If I understand well, what I try to do is impossible for
>>>> some deep theoretical reason. Can someone explain this
>>>> to me, or point me to a relevant paper explaining it?
>>>>
>>>>
>>> I think this is not a question of impossibility, rather of
>>> misunderstanding of the relation between modules and signatures.
>>> A module type describes modules, it does not replace them.
>>> In particular, in another mail you asked for the construct:
>>>
>>> module type MyModuleType(Param:ParamType) = sig ... end
>>>
>>> But this just doesn't make sense. The type of a functor is not a
>>> functor between module types. Just like the type "t1 * t2" describes
>>> pairs of values of type t1 and t2, but it is not itself a pair of
>>> types, but rather a product.
>>>
>>> Note of course that one might want to play on the conceptual
>>> similarity to write the two in the same way. Haskell does that a lot,
>>> writing (t1,t2) for the product of the types t1 and t2. But if
>>> you look at languages like Coq, where types are also values, this
>>> kind of overloading seems dangerous.
>>>
>>> Another similar misunderstanding is when you write
>>> include Abc(module type of IntSet)
>>> This statement is doubly wrong: first you cannot apply a module type,
>>> but even if Abc were a functor, it could only be applied to a module,
>>> not a module type.
>>> Others have explained how you can do what you intended, in two
>>> different ways.
>>> The classical way is to use a real functor, returning a signature
>>> enclosed in a module, since there is no way to return a signature
>>> alone. There is nothing against applying functors inside signatures.
>>> The new solution in 3.12 is to use a variant of the "with"
>>> construct, which does exactly what you want, i.e. it turns a
>>> signature into a "function" returning a signature.
>>>
>>> Hope this helps,
>>>
>>> Jacques Garrigue
>>>
>>>
>>>
>>>
>> <dumitru_potop_butucaru.vcf>
>>
>
>
>
[-- Attachment #2: dumitru_potop_butucaru.vcf --]
[-- Type: text/x-vcard, Size: 335 bytes --]
begin:vcard
fn:Dumitru Potop-Butucaru
n:Potop-Butucaru;Dumitru
org:INRIA Rocquencourt;Project AOSTE
adr:;;Domaine de Voluceau, BP 105;Le Chesnay;;F-78153;France
email;internet:dumitru.potop_butucaru@inria.fr
tel;work:+33-139.63.55.80
tel;fax:+33-139.63.51.93
x-mozilla-html:FALSE
url:http://www.DumitruPotop.net
version:2.1
end:vcard
next prev parent reply other threads:[~2010-07-22 7:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 13:38 Dumitru Potop-Butucaru
2010-07-21 14:13 ` [Caml-list] " Jeremy Yallop
2010-07-21 15:49 ` rossberg
2010-07-21 18:41 ` Dumitru Potop-Butucaru
2010-07-22 2:29 ` Alain Frisch
2010-07-22 6:36 ` Dumitru Potop-Butucaru
2010-07-22 6:18 ` Jacques Garrigue
[not found] ` <4C47E768.4080507@inria.fr>
[not found] ` <9454F06C-C286-4A1F-8A9F-CA3B27F8E3BB@gmail.com>
2010-07-22 7:07 ` Dumitru Potop-Butucaru [this message]
2010-07-22 9:37 ` rossberg
2010-07-22 10:44 ` Jacques Garrigue
2010-07-22 12:28 ` Dumitru Potop-Butucaru
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=4C47EE3C.2010908@inria.fr \
--to=dumitru.potop_butucaru@inria.fr \
--cc=caml-list@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