caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Vincent Jacques <vincent@vincent-jacques.net>
To: Mikhail Mandrykin <mandrykin@ispras.ru>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Typing of recursive function with polymorphic variants
Date: Sat, 15 Apr 2017 10:23:46 +0200	[thread overview]
Message-ID: <CAEnGa7COrvixiCM3+N=Xe1e4KBSZ+MRqrjvBVx-SMQv98=3=hw@mail.gmail.com> (raw)
In-Reply-To: <3147640.9aH54fEQfF@molnar>

2017-04-14 20:47 GMT+02:00 Mikhail Mandrykin <mandrykin@ispras.ru>:
> let rec f2 : 'a 'b. ([<`A of 'a | `B ] as 'a) -> ([>`B] as 'b)= function
>   | `A x -> f2 (f2 x)
>   | `B -> `B;;
> val f2 : ([< `A of 'a | `B ] as 'a) -> [> `B ] = <fun>

Thank you Mikhail, this helps a lot.

I didn't know about polymorphic type annotations.

Thanks!
-- 
Vincent Jacques
http://vincent-jacques.net

"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème"
            Devise Shadock

      reply	other threads:[~2017-04-15  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 15:30 Vincent Jacques
2017-04-14 18:11 ` Mikhail Mandrykin
2017-04-14 18:47   ` Mikhail Mandrykin
2017-04-15  8:23     ` Vincent Jacques [this message]

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='CAEnGa7COrvixiCM3+N=Xe1e4KBSZ+MRqrjvBVx-SMQv98=3=hw@mail.gmail.com' \
    --to=vincent@vincent-jacques.net \
    --cc=caml-list@inria.fr \
    --cc=mandrykin@ispras.ru \
    /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).