Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
map as a member function?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <brian.hurt@q...>
Subject: map as a member function?

What I'm basically trying to do is write an object with the following 

class virtual ['a] foo :
method virtual doit : 'a
method map : 'b. ('a -> 'b) -> 'b foo

Where what foo#map returns is not a 'a foo, but a 'b foo. But when I try 
to compile the above interface as an .mli file, I get:

File "foo.mli", line 2, characters 6-100:
The abbreviation foo is used with parameters 'a foo
wich are incompatible with constraints 'b foo

I'm baffled- help?