caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Arlen Cuss <celtic@sairyx.org>
To: Francois Berenger <berenger@riken.jp>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] writing some code using a function for which only the signature is known
Date: Fri, 21 Jan 2011 21:56:19 +1100	[thread overview]
Message-ID: <1295607379.2365.1.camel@asu> (raw)
In-Reply-To: <4D391C4A.9000608@riken.jp>

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

On Fri, 2011-01-21 at 14:40 +0900, Francois Berenger wrote:
> Hello,
> 
> If I am writing some code, and I don't want to dive
> into implementing some sub function I will need but don't
> have yet, what is the standard way to do this in ocaml?
> 
> In python, there is the pass keyword, Haskell has some
> keyword which I don't remember for this also.
> 
> Sorry for the dumb question maybe, I am returning to ocaml
> after a too long absence. :)
> 
> Regards,
> Francois.
> 

I tend to use failwith (type is string -> 'a); it just raises Failure
with your string, so..

# let my_fun par1 par2 par3 =
    failwith "myfun not implemented";;
val my_fun : 'a -> 'b -> 'c -> 'd = <fun>
# let sub_fun = function
   | true -> 42
   | false -> my_fun 92 [1,2,3] 'x';;
val sub_fun : bool -> int = <fun>
# sub_fun true;;
- : int = 42
# sub_fun false;;
Exception: Failure "myfun not implemented".
# 

It type checks anything because it raises an exception.

Arlen

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2011-01-21 10:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21  5:40 Francois Berenger
2011-01-21  5:58 ` oliver
     [not found] ` <AANLkTikv07AgCJXKD_e_QvGGz5245svFGiTG85fpZC7P@mail.gmail.com>
2011-01-21  6:12   ` dmitry grebeniuk
2011-01-21 15:32     ` oliver
2011-01-21 18:26       ` dmitry grebeniuk
2011-01-21 10:56 ` Arlen Cuss [this message]
2011-01-21 13:49 mark
2011-01-21 15:20 ` Daniel Bünzli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295607379.2365.1.camel@asu \
    --to=celtic@sairyx.org \
    --cc=berenger@riken.jp \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).