caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] type printing error
@ 2014-09-15 15:20 Ashish Agarwal
  2014-09-16 11:34 ` Ashish Agarwal
  0 siblings, 1 reply; 2+ messages in thread
From: Ashish Agarwal @ 2014-09-15 15:20 UTC (permalink / raw)
  To: Caml List

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] type printing error
  2014-09-15 15:20 [Caml-list] type printing error Ashish Agarwal
@ 2014-09-16 11:34 ` Ashish Agarwal
  0 siblings, 0 replies; 2+ messages in thread
From: Ashish Agarwal @ 2014-09-16 11:34 UTC (permalink / raw)
  To: Caml List

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

To add info, I'm getting this error in the context of a larger program with
ocamlc, so it is not a utop specific issue. Unfortunately, I still can't
produce it in this smaller example outside of utop.

On Mon, Sep 15, 2014 at 11:20 AM, Ashish Agarwal <agarwal1975@gmail.com>
wrote:

> 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: 2688 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-16 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 15:20 [Caml-list] type printing error Ashish Agarwal
2014-09-16 11:34 ` Ashish Agarwal

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).