caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] mystified by typing of optional arguments
@ 2003-04-03 14:50 Francois Rouaix
  2003-04-03 15:04 ` Francois Thomasset
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Francois Rouaix @ 2003-04-03 14:50 UTC (permalink / raw)
  To: caml-list

Hi all,
The following example mystifies me

let f ?opt x =
   match opt with
   | None -> x
   | Some dx -> x + dx

let g x = x + 1


let h1 = function
   | 0 -> [g]
   | _ -> [f; g]


let h2 = function
   | _ -> [f; g]


h1 is typable but not h2.
Why is that ?

--f
PS: the example code is not meant to be useful in any way other than 
reproducing the behavior of type checking.

-------------------
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] 6+ messages in thread

end of thread, other threads:[~2003-04-04  0:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-03 14:50 [Caml-list] mystified by typing of optional arguments Francois Rouaix
2003-04-03 15:04 ` Francois Thomasset
2003-04-03 15:05 ` Ville-Pertti Keinonen
2003-04-03 15:08 ` Eric C. Cooper
2003-04-03 15:13 ` Jacques Carette
2003-04-04  0:36 ` 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).