caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ashish Agarwal <agarwal1975@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] type printing error
Date: Mon, 15 Sep 2014 11:20:00 -0400	[thread overview]
Message-ID: <CAMu2m2LazqSGq=M9++NCKvDbF5dg6y1s+7R=H+Av5-EPJiASZA@mail.gmail.com> (raw)

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

The following example leads to an assertion from printtyp.ml when loaded in
utop.  I made the example as small as I could, but unfortunately it still
depends on a package called Future which in turn depends on Core.

To run it you'll have to do:

$ opam pin add future https://github.com/agarwal/future
Then hit Y to install the package.

$ cat tmp.ml
open Future_std
let f items =
  Pipe.peek_deferred items >>= function
  | `Comment _ -> return ()


#require "future.std";;

# #use "tmp.ml";;
Fatal error: exception "Assert_failure typing/printtyp.ml:583:12"
Raised at file "bytes.ml", line 220, characters 25-34


Doing the equivalent in the standard ocaml toploop or compiling with
ocamlc/ocamlopt doesn't exhibit this assertion. You correctly get the real
error reported:

$ ocamlfind ocamlc -package future.std -thread tmp.ml
File "tmp.ml", line 5, characters 4-14:
Error: This pattern matches values of type [? `Comment of 'a ]
       but a pattern was expected which matches values of type
         ('b Future_std.Deferred.t as 'b) Future_std.Deferred.t
       The second variant type does not allow tag(s) `Comment


The assertion is also avoided if you replace `open Future_std` with a
copy/paste of the relevant part of Future_std.

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

             reply	other threads:[~2014-09-15 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 15:20 Ashish Agarwal [this message]
2014-09-16 11:34 ` Ashish Agarwal

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='CAMu2m2LazqSGq=M9++NCKvDbF5dg6y1s+7R=H+Av5-EPJiASZA@mail.gmail.com' \
    --to=agarwal1975@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).