* Pretty printing Toploop errors?
@ 2006-07-09 18:33 Geoffrey Alan Washburn
2006-07-10 10:54 ` [Caml-list] " Richard Jones
0 siblings, 1 reply; 5+ messages in thread
From: Geoffrey Alan Washburn @ 2006-07-09 18:33 UTC (permalink / raw)
To: caml-list
I'm trying to use Toploop within a program I'm working on and some code
I'm feeding it is causing a type error. Unfortunately, the best I've
been able to figure out is to use Toploop.print_exception_outcome or
Pcaml.report_error which just tell me
Uncaught exception: Typecore.Error (_, _)
Are there any hooks for printing out a useful type error message? Or am
I going to need to compile directly against the type-checking code from
the compiler? Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Pretty printing Toploop errors?
2006-07-09 18:33 Pretty printing Toploop errors? Geoffrey Alan Washburn
@ 2006-07-10 10:54 ` Richard Jones
0 siblings, 0 replies; 5+ messages in thread
From: Richard Jones @ 2006-07-10 10:54 UTC (permalink / raw)
To: Geoffrey Alan Washburn; +Cc: caml-list
On Sun, Jul 09, 2006 at 02:33:35PM -0400, Geoffrey Alan Washburn wrote:
> I'm trying to use Toploop within a program I'm working on and some
> code I'm feeding it is causing a type error. Unfortunately, the best I've
> been able to figure out is to use Toploop.print_exception_outcome or
> Pcaml.report_error which just tell me
>
>
> Uncaught exception: Typecore.Error (_, _)
>
>
> Are there any hooks for printing out a useful type error message? Or am
> I going to need to compile directly against the type-checking code from
> the compiler? Thanks!
Std.dump from Extlib will print whatever is inside the exception,
although it's not very pretty.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Pretty printing Toploop errors?
@ 2006-07-10 10:06 Keiko Nakata
2006-07-11 13:16 ` Geoffrey Alan Washburn
0 siblings, 1 reply; 5+ messages in thread
From: Keiko Nakata @ 2006-07-10 10:06 UTC (permalink / raw)
To: caml-list
> I'm trying to use Toploop within a program I'm working on and some code
>I'm feeding it is causing a type error. Unfortunately, the best I've
>been able to figure out is to use Toploop.print_exception_outcome or
>Pcaml.report_error which just tell me
>
>
> Uncaught exception: Typecore.Error (_, _)
>
>
>Are there any hooks for printing out a useful type error message? Or am
>I going to need to compile directly against the type-checking code from
>the compiler? Thanks!
Take a look at driver/errors.ml.
It may be useful.
Hope this helps,
Keiko.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Pretty printing Toploop errors?
2006-07-10 10:06 Keiko Nakata
@ 2006-07-11 13:16 ` Geoffrey Alan Washburn
2006-07-12 11:15 ` [Caml-list] " Jonathan Roewen
0 siblings, 1 reply; 5+ messages in thread
From: Geoffrey Alan Washburn @ 2006-07-11 13:16 UTC (permalink / raw)
To: caml-list
Keiko Nakata wrote:
> Take a look at driver/errors.ml.
> It may be useful.
Thanks, linking against driver/errors.cmo and using Errors.report_error
worked. However, is there some other library I could link against that
wouldn't require end-users having access to the OCaml sources? I did
some some investigation, but wasn't able to find one. I've seen some
posts in the past where people have been using Errors.report_error, but
it wasn't obvious from the context what they were linking to get it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Re: Pretty printing Toploop errors?
2006-07-11 13:16 ` Geoffrey Alan Washburn
@ 2006-07-12 11:15 ` Jonathan Roewen
2006-07-12 11:53 ` Geoffrey Alan Washburn
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Roewen @ 2006-07-12 11:15 UTC (permalink / raw)
To: Geoffrey Alan Washburn; +Cc: caml-list
> worked. However, is there some other library I could link against that
> wouldn't require end-users having access to the OCaml sources?
Have you tried toplevellib.cma?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Pretty printing Toploop errors?
2006-07-12 11:15 ` [Caml-list] " Jonathan Roewen
@ 2006-07-12 11:53 ` Geoffrey Alan Washburn
2006-07-30 19:40 ` [Caml-list] " Brian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: Geoffrey Alan Washburn @ 2006-07-12 11:53 UTC (permalink / raw)
To: caml-list
Jonathan Roewen wrote:
>> worked. However, is there some other library I could link against that
>> wouldn't require end-users having access to the OCaml sources?
>
> Have you tried toplevellib.cma?
I am, but if I only link against that ocamlc claims that it cannot find
the Errors module. If I add drivers/errors.cmo it works, but that is
only in available in the actual OCaml source tree. Is there something
else I should be trying?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Re: Pretty printing Toploop errors?
2006-07-12 11:53 ` Geoffrey Alan Washburn
@ 2006-07-30 19:40 ` Brian Campbell
2006-08-01 14:36 ` Geoffrey Alan Washburn
0 siblings, 1 reply; 5+ messages in thread
From: Brian Campbell @ 2006-07-30 19:40 UTC (permalink / raw)
To: Geoffrey Alan Washburn; +Cc: caml-list
On Wed, Jul 12, 2006 at 07:53:15AM -0400, Geoffrey Alan Washburn wrote:
> Jonathan Roewen wrote:
> >>worked. However, is there some other library I could link against that
> >>wouldn't require end-users having access to the OCaml sources?
> >
> >Have you tried toplevellib.cma?
>
> I am, but if I only link against that ocamlc claims that it cannot
> find the Errors module. If I add drivers/errors.cmo it works, but that is
> only in available in the actual OCaml source tree. Is there something
> else I should be trying?
You might have solved this in the meantime, but in case you haven't:
The problem is that the interface file errors.cmi isn't installed along
with ocaml. You could keep a copy of errors.mli with your program and
use that to make a suitable errors.cmi for compiling against. At least,
that seems to work for me.
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Pretty printing Toploop errors?
2006-07-30 19:40 ` [Caml-list] " Brian Campbell
@ 2006-08-01 14:36 ` Geoffrey Alan Washburn
0 siblings, 0 replies; 5+ messages in thread
From: Geoffrey Alan Washburn @ 2006-08-01 14:36 UTC (permalink / raw)
To: caml-list
Brian Campbell wrote:
> You might have solved this in the meantime, but in case you haven't:
>
> The problem is that the interface file errors.cmi isn't installed along
> with ocaml. You could keep a copy of errors.mli with your program and
> use that to make a suitable errors.cmi for compiling against. At least,
> that seems to work for me.
That seems to have solved the problem. Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-08-01 14:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-09 18:33 Pretty printing Toploop errors? Geoffrey Alan Washburn
2006-07-10 10:54 ` [Caml-list] " Richard Jones
2006-07-10 10:06 Keiko Nakata
2006-07-11 13:16 ` Geoffrey Alan Washburn
2006-07-12 11:15 ` [Caml-list] " Jonathan Roewen
2006-07-12 11:53 ` Geoffrey Alan Washburn
2006-07-30 19:40 ` [Caml-list] " Brian Campbell
2006-08-01 14:36 ` Geoffrey Alan Washburn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox