caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Carette <carette@mcmaster.ca>
To: David Allsopp <dra-news@metastack.com>
Cc: "'OCaml List'" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Re: Polymorphic variants question
Date: Fri, 01 Sep 2006 16:40:42 -0400	[thread overview]
Message-ID: <44F89ACA.2000202@mcmaster.ca> (raw)
In-Reply-To: <015101c6ce00$d47c36f0$6a7ba8c0@treble>

David Allsopp wrote:
> Incidentally, if I use an annotation free version
>
> let f x = if x = `A then (true, `B) else (false, (x : [< `A | `C] :> [> `A |
> `C]))
>
> then the inferred type of x is [< `A | `C > `A ] ... what does that mean?
>   
This is a "point free" notation for what mathematicians would have written
`A <= x <= `A | `C

In other words, x is strictly bounded above and below by those 2 types.  
Translated into english, this means that the type from which x comes 
*must* contain an `A and *may* contain a `C and *must not* contain 
anything else.

For example, trying
let g x = f (snd (f x))
would not type.

Jacques


  reply	other threads:[~2006-09-01 20:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-01 17:31 David Allsopp
2006-09-01 18:33 ` Chris King
2006-09-01 19:00   ` [Caml-list] " skaller
2006-09-01 19:57     ` David Allsopp
2006-09-01 20:40       ` Jacques Carette [this message]
2006-09-01 18:40 ` [Caml-list] " Olivier Andrieu
2006-09-01 19:26 ` Jon Harrop
2006-09-01 19:29 ` skaller
2006-09-01 20:49   ` Andres Varon
2006-09-02 11:16     ` Jacques Garrigue
2006-09-03  1:22       ` Andres Varon
2006-09-03  9:08         ` Jacques Garrigue
2006-09-03 15:00           ` Andres Varon
2006-09-03 23:18             ` Jacques Garrigue
2006-09-03  0:48   ` [Caml-list] Polymorphic variants problem skaller
2006-09-03  1:12     ` Andres Varon

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=44F89ACA.2000202@mcmaster.ca \
    --to=carette@mcmaster.ca \
    --cc=caml-list@yquem.inria.fr \
    --cc=dra-news@metastack.com \
    /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).