[m-dev.] Pretty printing non-canonical types

Ralph Becket rafe at csse.unimelb.edu.au
Mon Oct 8 10:49:25 AEST 2007


Ian MacLarty, Monday,  8 October 2007:
> On Fri, Oct 05, 2007 at 02:52:11PM +1000, Ralph Becket wrote:
> > I'm trying to debug the new LP interface.
> > The debugger uses the new pretty_printer module.
> > The pretty_printer module uses deconstruct(..., canonicalize, ...) to
> > decide what to do with each subterm.
> > The canonicalize form just returns the type name for non-canonical
> > values, rather than any structural information.
> > This is most unhelpful for debugging.
> > Using deconstruct(..., include_details_cc, ...) does the right thing,
> > but is cc_multi.
> > I want the include_details_cc behavious, but I don't want to propagate
> > the cc_multi aspect into the interface to the pretty printer, because
> > that could make using it rather awkward in many circumstances.
> > 
> > Is there any objection to me using include_details_cc wrapped in a
> > promise_equivalent_solutions scope, even though the promise is a lie?
> > 
> 
> Why not add a predicate like the following:
> 
> :- pred format_io(S::in, doc::in, formatter_map::in, int::in, int::in,
>     formatting_limit::in, io::di, io::uo) is det <= stream.writer(S,
>     string, io).
> 
> in which you do the required promise.  The promise is okay under a
> suitable interpretation of the IO state.

Which interpretation do you have in mind?  I don't see it.

I think Mark's justification is probably sufficient: the viewer of a
different representations of the same non-canonical values will give
them the same denotation, which means the results from deconstruct
are semantically equivalent in the sense intended by
promise_equivalent_solutions.

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list