Le ven 08 déc 2006 18:31:23 CET,
"drehman27" < drehman27%40yahoo.com">drehman27
yahoo.com> a écrit :
> I thought that you could define a functor either way. I don't
> understand what's wrong with my definition!
> Anyway, thanks a lot for the example.
>
> module Name : Type =
> functor (..) ->
> struct
> ...
> end
>
> or
>
> module Name =
> functor (..) ->
> (struct
> ...
> end: Type)
>
The type constraint does not apply on the same object in both cases: in
the first one, Type represents the type of the whole functor (and has
to be a functor type). In the latter one, Type is the (module) type of
the result of the functor. This is exactly the same thing as with
functions:
let f : int = fun x -> x + x (* wrong, f is a function, not an int *)
let f = fun x -> (x + x: int) (*OK: we specify the type of the result*)
--
E tutto per oggi, a la prossima volta.
Virgile
.