* [Caml-list] module type and record
[not found] <65D56CA3-9FDA-11D7-813D-000A95764898@ens-lyon.fr>
@ 2003-06-16 9:59 ` efiliot
2003-06-16 15:08 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: efiliot @ 2003-06-16 9:59 UTC (permalink / raw)
To: caml-list
hello,
I need to declare a record type in a field like :
module A : ( MY_TYPE with type t = { label1 : int ; label2 : string } ) =
struct
....
end
but the compiler seems to refuse this declaration.
Could you give me a solution for this problem ?
Thank You,
Emmanuel Filiot
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] module type and record
2003-06-16 9:59 ` [Caml-list] module type and record efiliot
@ 2003-06-16 15:08 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2003-06-16 15:08 UTC (permalink / raw)
To: efiliot; +Cc: caml-list
> hello,
> I need to declare a record type in a field like :
>
> module A : ( MY_TYPE with type t = { label1 : int ; label2 : string } ) =
> struct
> ....
> end
>
> but the compiler seems to refuse this declaration.
Currently, only type abbreviations can be added with the "with type"
construct: MODTYPE with type t = some_type_expression.
This restriction is somewhat artificial and I'm considering lifting it.
> Could you give me a solution for this problem ?
Currently, you need to expand "MY_TYPE with..." by hand into
sig
type t = { label1 : int ; label2 : string }
(* other elements of signature MY_TYPE
end
An alternative is to declare the record type separately:
type my_rec = { label1 : int ; label2 : string }
module A : (MY_TYPE with type t = my_rec) = ...
- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-06-16 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <65D56CA3-9FDA-11D7-813D-000A95764898@ens-lyon.fr>
2003-06-16 9:59 ` [Caml-list] module type and record efiliot
2003-06-16 15:08 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox