caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Typing problem with polymorphic variants
@ 2003-04-01 17:34 Alessandro Baretta
  2003-04-01 18:38 ` Ville-Pertti Keinonen
  2003-04-01 18:44 ` David Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Alessandro Baretta @ 2003-04-01 17:34 UTC (permalink / raw)
  To: Ocaml

This just baffles me.

 > Values do not match:
 >   val feature :
 >     [> `Clear | `Length of int | `Pitch of int
 >               | `Width of 'a] -> string
 > is not included in
 >   val feature : [> `Clear] -> string

Why are "match-anything" functions of the kind of

let f = function
   | `Foo -> "foo"
   | `Bar -> "bar"
   | _ -> "?"

incompatible with signatures like

val f : [> `Foo ] -> string
?


There clearly is no case when a value of type [> `Foo] will 
not be acceptable for f. So why does the type checker reject 
this?

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-02  1:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-01 17:34 [Caml-list] Typing problem with polymorphic variants Alessandro Baretta
2003-04-01 18:38 ` Ville-Pertti Keinonen
2003-04-01 17:56   ` Alessandro Baretta
2003-04-01 18:44 ` David Brown
2003-04-02  1:34   ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).