Version française
Home     About     Download     Resources     Contact us    
Browse thread
A second functor question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <AndreasRossberg@w...>
Subject: Re: [Caml-list] A second functor question
John F. Hughes <jfh@cs.brown.edu> wrote:
> 
> module type COMBINE =
>    sig
>       module A : P
>       module B : P
>    end;;
>  with A.t = B.t;;
> 
> [...]
> 
> module Fun = 
>    functor (Z : COMBINE) -> 
>      struct
>         let f x:Z.A.t = Z.B.foo x 
>      end;;
> 
> This will fail because Z.B.foo expects a B.t, but is being handed an
> A.t. 

It works when you define COMBINE as

 module type COMBINE =
    sig
       module A : P
       module B : P with type t = A.t
    end

Hope this helps,

    - Andreas