* [Caml-list] return type annotation syntax?
@ 2011-01-26 23:54 Raoul Duke
2011-01-27 0:01 ` Guillaume Yziquel
0 siblings, 1 reply; 4+ messages in thread
From: Raoul Duke @ 2011-01-26 23:54 UTC (permalink / raw)
To: OCaml
hi,
how do i annotate/specify the return type of a function i'm writing? i
see how to specify the type of the input arguments, but i didn't
figure out how to say what the return type is.
thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] return type annotation syntax?
2011-01-26 23:54 [Caml-list] return type annotation syntax? Raoul Duke
@ 2011-01-27 0:01 ` Guillaume Yziquel
2011-01-27 0:12 ` Raoul Duke
0 siblings, 1 reply; 4+ messages in thread
From: Guillaume Yziquel @ 2011-01-27 0:01 UTC (permalink / raw)
To: Raoul Duke; +Cc: OCaml
Le Wednesday 26 Jan 2011 à 15:54:48 (-0800), Raoul Duke a écrit :
> hi,
>
> how do i annotate/specify the return type of a function i'm writing? i
> see how to specify the type of the input arguments, but i didn't
> figure out how to say what the return type is.
>
> thanks.
let f (x : input_typ) : return_type = ...
--
Guillaume Yziquel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] return type annotation syntax?
2011-01-27 0:01 ` Guillaume Yziquel
@ 2011-01-27 0:12 ` Raoul Duke
2011-01-27 0:41 ` Guillaume Yziquel
0 siblings, 1 reply; 4+ messages in thread
From: Raoul Duke @ 2011-01-27 0:12 UTC (permalink / raw)
To: OCaml
On Wed, Jan 26, 2011 at 4:01 PM, Guillaume Yziquel
> let f (x : input_typ) : return_type = ...
oh, thanks! i was trying to use "->" in there somewhere just doing
lame human pattern matching on what the repl prints as types for
things, and i even saw "->" in the ocaml grammar spec for types so i
was figuring the "->" was to be used. :-P
:)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] return type annotation syntax?
2011-01-27 0:12 ` Raoul Duke
@ 2011-01-27 0:41 ` Guillaume Yziquel
0 siblings, 0 replies; 4+ messages in thread
From: Guillaume Yziquel @ 2011-01-27 0:41 UTC (permalink / raw)
To: Raoul Duke; +Cc: OCaml
Le Wednesday 26 Jan 2011 à 16:12:40 (-0800), Raoul Duke a écrit :
> On Wed, Jan 26, 2011 at 4:01 PM, Guillaume Yziquel
>
> > let f (x : input_typ) : return_type = ...
>
> oh, thanks! i was trying to use "->" in there somewhere just doing
> lame human pattern matching on what the repl prints as types for
> things, and i even saw "->" in the ocaml grammar spec for types so i
> was figuring the "->" was to be used. :-P
Well, you can always write
let f : input_type -> output_type = function x -> ...
--
Guillaume Yziquel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-27 0:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 23:54 [Caml-list] return type annotation syntax? Raoul Duke
2011-01-27 0:01 ` Guillaume Yziquel
2011-01-27 0:12 ` Raoul Duke
2011-01-27 0:41 ` Guillaume Yziquel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox