caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Type inference problem
@ 2001-06-28 15:23 Vasilij Karpow
  2001-06-28 15:40 ` Remi VANICAT
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Vasilij Karpow @ 2001-06-28 15:23 UTC (permalink / raw)
  To: caml-list

Can anyone explain why O'Caml specializes the following:

let simple ?fn list =
  let fn = match fn with
  | Some fn -> fn
  | None -> fun t -> t in
  let rec print = function
    | [] -> ()
    | x :: xs -> print_endline (fn x); print xs
  in
  print list

let _ =
  simple ["1"];
  simple ~fn:(fun i -> string_of_int i) [1]


to: val simple : ?fn:(string -> string) -> string list -> unit

Thanks in advance.
    
P.S. A bit offtopic. I suspect this mailing list is filled with
skilled mathematicians (and just intelligent people), and since
nobody i know was able to solve my problem, here it is:
http://algol.prosalg.no/~malc/moo.ps [.dvi|.pdf|.tex]    

-- 
mailto:malc@pulsesoft.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [Caml-list] Type inference problem
@ 2005-11-01  7:58 Jonathan Roewen
  2005-11-01  8:19 ` Jonathan Roewen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jonathan Roewen @ 2005-11-01  7:58 UTC (permalink / raw)
  To: caml-list

Hi,

I can't figure out what's wrong with my code =(

It's on a paste site, so will only last about 24 hours or so.
http://rafb.net/paste/results/Uux57B97.html

jonathan@moonbeam:~/dst/stdlib$ ocamlc VFS.ml
File "VFS.ml", line 106, characters 3-6:
This expression has type int but is here used with type unit

It -has- to return int ;-) But I have no idea where the type
constraint is coming from that wants it to return unit. Change it to
return unit, and where it's used complains it doesn't return type int
(so that constraint is correct).

Jonathan


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

end of thread, other threads:[~2005-11-01 16:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-28 15:23 [Caml-list] Type inference problem Vasilij Karpow
2001-06-28 15:40 ` Remi VANICAT
2001-06-28 19:08 ` Nils Goesche
2001-06-29  2:41 ` Jacques Garrigue
2005-11-01  7:58 Jonathan Roewen
2005-11-01  8:19 ` Jonathan Roewen
2005-11-01  8:50   ` skaller
2005-11-01  8:34 ` skaller
2005-11-01 16:21 ` Brian Hurt

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