caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Lukasz Stafiniak <lukstafi@gmail.com>
To: Caml <caml-list@inria.fr>
Subject: Re: [Caml-list] Polymorphic recursion and GADTs
Date: Mon, 9 Dec 2013 22:34:40 +0100	[thread overview]
Message-ID: <CAJMfKEWEcbFaQs2fPRj9xah+RTSkpmywpg2fsbusmacndViXQg@mail.gmail.com> (raw)
In-Reply-To: <CAJMfKEU6=ddcuFHj909L9kU0B1jN3kYm-aXY24th8b6vtaV9_A@mail.gmail.com>

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

The annotation needs to be directly at the "function" node:

let rec walk : type a b . (a place -> b place -> (a, b) nearby) =
  (fun x goal ->
    ((function Same -> Here (x, goal)
       | NotSame ->
           let Ex1 ((y, to_y)) = wander x in
           Transitive (to_y, walk y goal))
    : ((a, b) meet -> (a, b) nearby))
      (compare x goal))

Regarding the first part, thanks to Gabriel, that explained it to me.

On Mon, Dec 9, 2013 at 6:24 PM, Lukasz Stafiniak <lukstafi@gmail.com> wrote:

> On Mon, Dec 9, 2013 at 6:16 PM, Lukasz Stafiniak <lukstafi@gmail.com>wrote:
>
>> Hello,
>>
>> I am at a loss as to the difference between ['a.] syntax and [type a.]
>> syntax of introducing polymorphic recursion. I will provide some examples.
>> (Bear with me, they are automatically generated.)
>> [...]
>> Now to a more complex example.
>>
>
> In the complex example, the problem is not the difference between ['a.]
> syntax and [type a.] syntax, but polymorphic recursion and GADTs in OCaml
> generally. What type annotations do I need to provide?
>

[-- Attachment #2: Type: text/html, Size: 2087 bytes --]

  reply	other threads:[~2013-12-09 21:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09 17:16 Lukasz Stafiniak
2013-12-09 17:24 ` Lukasz Stafiniak
2013-12-09 21:34   ` Lukasz Stafiniak [this message]
2013-12-10 13:20     ` Lukasz Stafiniak
2013-12-10 13:21       ` Lukasz Stafiniak
2013-12-10 14:24         ` Lukasz Stafiniak
2013-12-10 19:07           ` Gabriel Scherer
2013-12-10 22:43           ` Jacques Garrigue
2013-12-10 22:51             ` Lukasz Stafiniak
2013-12-10 22:55               ` Lukasz Stafiniak
2013-12-09 17:25 ` 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=CAJMfKEWEcbFaQs2fPRj9xah+RTSkpmywpg2fsbusmacndViXQg@mail.gmail.com \
    --to=lukstafi@gmail.com \
    --cc=caml-list@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).