Browse thread
Private types
[
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: | 2008-10-30 (20:18) |
From: | David Allsopp <dra-news@m...> |
Subject: | Private types |
I'm trying to play with the new private type abbreviations in OCaml 3.11+beta1 If I write: module type S = sig type t = private int val create : int -> t end;; module M : S = struct type t = int let create x = x end;; let x = M.create 0;; Shouldn't I now be able to say: string_of_int x;; But I get a type error... I'm struggling to see what difference the private declaration has made, therefore. I thought that the point of private types was that you could deconstruct them... so values of type M.t are valid wherever an int is used but not the converse. Or have I missed something? <prepares to be embarrassed...> David