From: Christian Sternagel <christian.sternagel@uibk.ac.at>
To: caml-list@yquem.inria.fr
Subject: Problem with Functors and Module Types
Date: Fri, 01 Aug 2008 13:10:04 +0200 [thread overview]
Message-ID: <4892EF0C.5090505@uibk.ac.at> (raw)
Hello,
once again I have some problems using functors with module types. I
produced following (almost?) minimal example:
module type MT_M = sig
type s
type t = A of s | B of t list
val f : t -> t
end
module type MT_N = sig
module M : MT_M
val f : 'a -> M.t
end
module type MT_A = sig
type t
end
module MakeM (A : MT_A) : MT_M with type s = A.t = struct
type s = A.t
type t = A of s | B of t list
let f x = x
end
module MakeN (A : MT_A) (* : MT_N *) = struct
module M = MakeM (A)
let f _ = M.B []
end
module A = struct
type t = int
end
module M = MakeM (A)
module N = MakeN (A)
let _ = (M.f (N.f 1))
This file compiles, but when I comment-in the module type restriction
for `MakeN' the error
This expression has type N.M.t = MakeN(A).M.t but is here used with type
M.t = MakeM(A).t
occurs. I understand that in the current setting the two types are not
equal for the compiler. However, my question is: Is there a way to tell
the compiler that the two types should be equal?
cheers
christian
next reply other threads:[~2008-08-01 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-01 11:10 Christian Sternagel [this message]
2008-08-01 11:58 ` [Caml-list] " Julien Signoles
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=4892EF0C.5090505@uibk.ac.at \
--to=christian.sternagel@uibk.ac.at \
--cc=caml-list@yquem.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