any types in signatures of functor arguments
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:   (:) 
From:  Hendrik Tews <tews@t...> 
Subject:  Re: [Camllist] any types in signatures of functor arguments 
Keiko Nakata <keiko@kurims.kyotou.ac.jp> writes: Why I cannot have *any types* in signatures of functor arguments? Concretely, the following F is not typable. module F(X:sig type t = [`A of _ ] val f : t > int end) = struct let f = function `A x as a > X.f a  `B > 0 end The problem is rather that your type abbreviation is illegal: # type t = [`A of _ ];; A type variable is unbound in this type declaration. In case `A of 'a the variable 'a is unbound Use module F(X:sig val f : [`A of _ ] > int end) = struct let f = function `A x as a > X.f a  `B > 0 end or a type abbreviation that works. Either type 'a t = [`A of _ ] as 'a;; or type 'a t = [`A of _ as 'a ];; Where the latter is the same as the already proposed type 'a t = [ `A of 'a ];; Bye, Hendrik