caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: brogoff <brogoff@speakeasy.net>
To: Jim Farrand <jim@farrand.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Type indexed types?
Date: Tue, 25 Jan 2005 10:37:54 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0501251011330.8479@shell1.speakeasy.net> (raw)
In-Reply-To: <20050125122849.GB15086@draco.xyxyx.org>

You are close, I think, to related things that would probably interest you

Try googling these

"type indexed data types"
"guarded algebraic data types"

in particular, see Simonet and Pottier's work available from the project
Cristal web site.

I think the application of constraint solving to type systems is a popular
topic these days in the type theory community.

-- Brian

On Tue, 25 Jan 2005, Jim Farrand wrote:

> Hi,
>
> This is what I need to do:
>
> Given a type, u, and a collection of types, ts, find a type t such that:
>   * t is a member of ts
>   * t can be unified with u
>   * There is no type v in ts, which unifies with u and is more general
>     than t.
>
> (In other words, find the most specific type in ts that is still equal
> to or a generalisation of u.)
>
> For example:
>
> ts = list int, int, list 'a, 'a
>
> For u = list int, the result would be list int.  For u = list string,
> the result would be list 'a, and for u = string the result would be 'a.
>
> Note that I already have a function which can compute if type a is a
> specialisation of type b.
>
> I think that in theory, I could do a brute force approach:
>   * Grab all types in ts that are generalisations of u.
>   * Order the results according to how specific they are.
>   * Arbitrarily choose one of the most specific.
>
> But there must be a smarter way!  Eg, I think that I should be able to
> start with the type u, and incrementally generalise it until I find a
> match.  It is tricky to find a method of generalisation that will cover
> the entire search space, and find the most specific type first.
>
> I am sure there must be papers on this, but I am having trouble coming
> up with the right search terms - references appreciated! :)
>
> Thanks in advance,
> Jim
>
> --
> Jim Farrand
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


      parent reply	other threads:[~2005-01-25 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-25 12:28 Jim Farrand
2005-01-25 17:01 ` [Caml-list] " skaller
2005-01-25 17:24   ` skaller
2005-01-25 17:49     ` skaller
2005-01-25 18:36       ` skaller
2005-01-25 18:37 ` brogoff [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=Pine.LNX.4.58.0501251011330.8479@shell1.speakeasy.net \
    --to=brogoff@speakeasy.net \
    --cc=caml-list@inria.fr \
    --cc=jim@farrand.net \
    /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).