[m-dev.] User-controlled pretty-printing

Peter Ross pro at missioncriticalit.com
Wed Nov 1 16:51:02 AEDT 2006


On 11/1/06, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
> An oft cited request for the debugger is the ability to control how
> different types are pretty-printed.  To date we have assumed that this
> requires dynamic type class casts so we could ask of any value X whether
> it is a member of the pretty_printable type class and if so use the
> pretty_printable method, otherwise use the default method.  For
> technical reasons, dynamic type class casts are still some way off.
>
> I have an alternative proposal that should work for the debugger and
> program output in general.  The idea is that we have a global mutable
> attached to the IO state consisting of a list of predicates with the
> signature
>
>         pred(univ::in, pprint.doc::out) is semidet
>
> and we add a predicate
>
>         % io.pprint(LineWidth, Value, !IO).
>         %
> :- pred io.pprint(int::in, T::in, io::di, io::uo) is det.
>
Only one issue, this should be

:- pred io.pprint(int::in, T::in, pprint.doc::out, io::di, io::uo) is det.

Then the user can decide where they want to print the doc.
--------------------------------------------------------------------------
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