caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@janestreet.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: "Carette, Jacques" <carette@mcmaster.ca>,
	"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Option to fully expand types in error messages?
Date: Thu, 2 Jun 2016 15:50:26 -0400	[thread overview]
Message-ID: <CACLX4jQUsitu=8HM-SCM_7vRzx9x5AuhSwMxw4b_nTXjh1b1Sg@mail.gmail.com> (raw)
In-Reply-To: <CAPFanBHCxoX0dr4qw2MWX2cwA=ffk7L2_g2JtErv_3owz-d4Qg@mail.gmail.com>

Have you tired using the short-paths flag?  This doesn't completely
expand the types, but it does a good job of picking the "right" type:
the heuristic is (roughly) to pick the type alias with the fewest
number of dots, and amongst those, pick the one defined most recently.
It tends to make type errors quite a lot better, but I admit I'm not
sure it would help in the case you describe.

y



On Thu, Jun 2, 2016 at 3:44 PM, Gabriel Scherer
<gabriel.scherer@gmail.com> wrote:
> This does not exist to my knowledge. I think that in a bug report, it
> would be interesting if you could include some reproducible code and
> an example of the error messages that are not readable. I would expect
> that a better solution exists, that expands enough of the paths to
> clarify the error, without expanding constraints that are not related
> to the type error.
>
> One thing you might try to play with is the -short-paths options, that
> tries to print shorter types (but is also possibly less predictable);
> it can  expand more if that can result in showing a shorter path, so
> for types that are synonyms of existing paths plus constraints it
> might result in constraint expansion. (I suspect it will not solve
> your problem, but that it may be of interest to other people with
> unclear type error messages.)
>
> On Thu, Jun 2, 2016 at 3:18 PM, Carette, Jacques <carette@mcmaster.ca> wrote:
>> In writing some code which uses a lot of monads with underlying types which
>> use constraints, even simple errors can lead to extremely hard to read error
>> messages.  The main reason is that the two types given in errors are
>> partially expanded, to different levels.  This frequently means that the
>> part where the type checker detects a mismatch is (extremely) opaque to
>> human eyes.
>>
>> In that case, it would actually be preferable to fully expand the types.
>> Yes, that will produce wallpaper.  But at least the mismatch should be
>> considerably easier to catch.
>>
>> Does this already exist, or should I submit a feature request?
>>
>> Jacques
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2016-06-02 19:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 19:18 Carette, Jacques
2016-06-02 19:44 ` Gabriel Scherer
2016-06-02 19:50   ` Yaron Minsky [this message]
2016-06-02 21:59     ` Carette, Jacques
2016-06-02 23:59 ` Jacques Garrigue
2016-06-03 15:42   ` Carette, Jacques
2016-06-03 15:50     ` Yaron Minsky
2016-06-04  6:27     ` Jacques Garrigue

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='CACLX4jQUsitu=8HM-SCM_7vRzx9x5AuhSwMxw4b_nTXjh1b1Sg@mail.gmail.com' \
    --to=yminsky@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=carette@mcmaster.ca \
    --cc=gabriel.scherer@gmail.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).