Version française
Home     About     Download     Resources     Contact us    
Browse thread
any types in signatures of functor arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: any types in signatures of functor arguments
Hello.

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 above F could be made typable as in

module F(X:sig type s type t = [`A of s ] val f : t -> int end) = 
  struct
    let f = function `A x as a -> X.f a | `B -> 0
  end

However, this change requires me to add the type component s
to every module to which F are going to be applied.
This is not very nice...

Regards,
Keiko Nakata