caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Not a variant??
@ 2008-08-19 22:53 Jacques Carette
  2008-08-20  3:21 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 4+ messages in thread
From: Jacques Carette @ 2008-08-19 22:53 UTC (permalink / raw)
  To: OCaml

The function f1 below works fine -- so type d is seen to be a variant type.
However, f2 does not compile because type c is *not* a variant type. 

However, if one looks at O'Caml's output for type c, it visually looks 
like a variant, while that of d does not.  This is highly confusing.

This looks like a bug to me -- both c and d should be recognized as 
variant types.

Jacques

type a = [`A ]
type b = [`B ]
type 'a c = 'a
    constraint 'a = [< a | b]
    ;;
type 'a d = 'a
    constraint 'a = b
    ;;

let f1 = function
    | #d -> true
    | _  -> false

let f2 = function
    | #c -> true
    | _  -> false
;;


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

end of thread, other threads:[~2008-08-21  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-19 22:53 Not a variant?? Jacques Carette
2008-08-20  3:21 ` [Caml-list] " Jacques Garrigue
2008-08-20 13:24   ` Jacques Carette
2008-08-21  5:10     ` 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).