caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] matching GADT option types
@ 2019-01-17  9:46 Christopher Zimmermann
  2019-01-17  9:58 ` Jeremy Yallop
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christopher Zimmermann @ 2019-01-17  9:46 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

Hi,

why does the f type correctly while g fails to type?

Christopher

type 'a t =
  | A : unit t

let f =
  fun (type a) ~(p :a t option) () -> match p with
    | Some A -> ()
    | None -> ()

let g =
  fun (type a) ~(p :a t option) () -> match p with
    | Some A (* TYPING ERROR HERE *)
    | None -> ()

Error: This pattern matches values of type unit t
       but a pattern was expected which matches values of type a t
       Type unit is not compatible with type a


-- 
http://gmerlin.de
OpenPGP: http://gmerlin.de/christopher.pub
CB07 DA40 B0B6 571D 35E2  0DEF 87E2 92A7 13E5 DEE1

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-01-17 10:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17  9:46 [Caml-list] matching GADT option types Christopher Zimmermann
2019-01-17  9:58 ` Jeremy Yallop
2019-01-17 10:02 ` Christopher Zimmermann
2019-01-17 10:18   ` Gabriel Scherer
2019-01-17 10:12 ` Gabriel Scherer
2019-01-17 10:08   ` Christopher Zimmermann

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).