English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
question on type checking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stephen Weeks <sweeks@s...>
Subject: question on type checking
Why does one of the programs below fail to type check while the other two minor
variants succeed?  I would expect all three to succeed.

----------------------------------------------------------------------
(* FAILS *)
module F (Z : sig end) = struct
  type t = A
end

module S = struct
  module Z = struct end
  module M = F (Z)
  include M
end

let f x =
  let module S = S in
  match x with
  | S.A -> ()
----------------------------------------------------------------------
(* WORKS *)
module F (Z : sig end) = struct
  type t = A
end

module S = struct
  module M = F (struct end)
  include M
end

let f x =
  let module S = S in
  match x with
  | S.A -> ()
----------------------------------------------------------------------
(* WORKS *)
module F (Z : sig end) = struct
  type t = A
end

module S = struct
  module Z = struct end
  module M = F (Z)
  include M
end

let f x =
  match x with
  | S.A -> ()
----------------------------------------------------------------------