You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1180 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Sami Mäkelä
Version: O'Caml 3.04
OS: Linux
Submission from: cccl.rdyn.saunalahti.fi (195.197.127.50)
I have a problem with complex functor application.
Everything works correctly if Z1 and Z2 are in different files or if
the argument functors are declared before they are used.
The problem this code is supposed to solve is that I have
several different modules with same interface S, and I want to write
some code parameterized by them, but I don't want to apply the
functor for all of the modules.
module type S = sig
type t
end
module type T = functor (S:S) -> sig
type t
val f : t
end
module String = struct type t = string end
module M (F:T) = struct
module M2 = F (String)
end
module Z1 = M
(functor (K:S) -> struct
type t = K.t -> K.t
let f x = x
end)
module Z2 = M
(functor (K:S) -> struct
type t = K.t -> int
let f x = 0
end)
let _ = Z2.M2.f ""
The text was updated successfully, but these errors were encountered:
I have a problem with complex functor application.
Everything works correctly if Z1 and Z2 are in different files or if
the argument functors are declared before they are used.
You have indeed uncovered a subtle (and long-standing) bug in the module
type-checker, related to the handling of type paths of the form F(M).t.
The bug is of the "premature optimization" kind, so it's easy to fix
by removing the optimization :-)
The bug will be fixed in the forthcoming release 3.05 of OCaml.
Indeed, it is fixed in the working version that you can access at http://camlcvs.inria.fr/ if you'd like to test.
Original bug ID: 1180
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Sami Mäkelä
Version: O'Caml 3.04
OS: Linux
Submission from: cccl.rdyn.saunalahti.fi (195.197.127.50)
I have a problem with complex functor application.
Everything works correctly if Z1 and Z2 are in different files or if
the argument functors are declared before they are used.
The problem this code is supposed to solve is that I have
several different modules with same interface S, and I want to write
some code parameterized by them, but I don't want to apply the
functor for all of the modules.
module type S = sig
type t
end
module type T = functor (S:S) -> sig
type t
val f : t
end
module String = struct type t = string end
module M (F:T) = struct
module M2 = F (String)
end
module Z1 = M
(functor (K:S) -> struct
type t = K.t -> K.t
let f x = x
end)
module Z2 = M
(functor (K:S) -> struct
type t = K.t -> int
let f x = 0
end)
let _ = Z2.M2.f ""
The text was updated successfully, but these errors were encountered: