Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Erkki Seppala <flux-caml@inside.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Removing repeating code
Date: Fri, 18 Jan 2013 09:08:12 +0200	[thread overview]
Message-ID: <m49ip6vt1cz.fsf@coffee.modeemi.fi> (raw)
In-Reply-To: <87r4ljrogn.fsf@golf.niidar.ru> (Ivan Gotovchits's message of "Fri, 18 Jan 2013 10:32:08 +0400")


Ivan Gotovchits <ivg@ieee.org> writes:
>     let f = function | Strings a | Floats a -> Array.length a;;
>                        ^^^^^^^^^^^^^^^^^^^^
>   Error: This pattern matches values of type string array
>          but a pattern was expected which matches values of type float array

Ah, sorry, I completely missed that they were different kind of arrays,
which was of course the point of the example. But as far as I know,
there is no way to remove code duplication in this case, barring tucking
the code 'away' to another function or doing tricks with
Obj.magic. (Well, unless the GADT support brings something to new the
table related to this, but I wouldn't know.)

-- 
  _____________________________________________________________________
     / __// /__ ____  __               http://www.modeemi.fi/~flux/\   \
    / /_ / // // /\ \/ /                                            \  /
   /_/  /_/ \___/ /_/\_\@modeemi.fi                                  \/

  reply	other threads:[~2013-01-18  7:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18  4:57 Ivan Gotovchits
2013-01-18  6:13 ` Erkki Seppala
2013-01-18  6:32   ` Ivan Gotovchits
2013-01-18  7:08     ` Erkki Seppala [this message]
2013-01-18 14:14       ` Gabriel Scherer

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=m49ip6vt1cz.fsf@coffee.modeemi.fi \
    --to=flux-caml@inside.org \
    --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