[m-rev.] For review: user-configurable pretty printer

Peter Ross pro at missioncriticalit.com
Wed Jun 6 09:07:08 AEST 2007


On 6/5/07, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
>     % The type and inst of pretty-printer converters.
>     %
> :- type pp == ( pred(univ, docs) ).
> :- inst pp == ( pred(in, out) is semidet ).
>
I did a similar thing once to add user defined pretty printing, except
I used the type_desc to see if a particular type had a pretty printing
alternative.

:- pred register_pretty_printer(type_desc::in, (func(univ) = doc)::in,
io::di, io::uo) is det.

Then the pretty printing code simply checked a map to see if the
current type was handled specially by the pretty printer.

This maybe more efficient then trying a potentially very long list of
predicates to find one which succeeds.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list