List Info

Thread: "ocaml_beginners"::[] polymorphic methods (and I've read the same named section of the manual :-)




"ocaml_beginners"::[] polymorphic methods (and I've read the same named section of the manual :-)
user name
2006-07-27 14:18:29
--- In ocaml_beginners@yahoogroups.com,
"vincent.aravantinos" 
Furthermore if I let ocaml decide of the type for me :

class ['a] myclass (a_list : 'a list) =
object
val the_list = a_list
method map f = new myclass (List.map f the_list)
end

Then it tells me :

class ['a] myclass :
  'a list ->
  object val the_list : 'a list method map : ('a ->
'a) -> 'a myclass 
end

-> It compiles but ocaml believe that the argument of map
('f') must 
be of type 'a -> 'a ; where I want some 'a -> 'b !

Why does it believe that myclass must keep the same type ?






Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http:/
/groups.yahoo.com/group/ocaml_beginners/

<*> To unsubscribe from this group, send an email to:
    ocaml_beginners-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 



[1]

about | contact  Other archives ( Real Estate discussion Medical topics )