[mercury-users] Is there something like string__from_anything?

Ralph Becket rbeck at microsoft.com
Fri Sep 7 01:03:50 AEST 2001


> From: Ondrej Bojar [mailto:oboj7042 at ss1000.ms.mff.cuni.cz]
> Sent: 06 September 2001 15:53
> 
> Hi.
> 
> I wonder if there is a hidden predicate something like:
> 
> :- pred string__from_anything(T::in, string::out) is det.
> 
> It should do what io__write(T, io__state, io__state) does, that is
print
> any structure in a human readable format, but the output should go
into a
> string, not into an output stream.

Have a look at the pprint module in the library, specifically
pprint__to_doc/1 and pprint__to_string/2 (the former will turn almost
any type into an abstract representation which can be formatted as a
string by the latter).

Some performance problems have been reported for pretty printing
very large terms; please let me know if you have any problems as
sample problem cases would be very useful in tracking down the bug.

- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list