private rows question

Keiko Nakata
 Jacques Garrigue
[
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:  Jacques Garrigue <garrigue@m...> 
Subject:  Re: [Camllist] private rows question 
From: Keiko Nakata <keiko@kurims.kyotou.ac.jp> > Why the following functor G is not typable? > I thought that g could have a type something like int > [< `A  `B ]. > > module G(X:sig type t = private [< `A ] val f : int > t end) = struct > let g x = if x = 0 then `B else X.f x > end Since g may return `B, and probably `A (the probably concerns your intention), the expected type would be g : int > [> `A  `B ] Next, if you want f to have a private row type, then you should disconnect its type from the type of g (otherwise the type of g must be the same as f.) So I would expect something like: let g x = if x = 0 then `B else (X.f x : [< `A] :> [> `A]) Jacques