[clean-list] making use of _print_graph

Ronny Wichers Schreur ronny@cs.kun.nl
Fri, 03 Nov 2000 09:17:20 +0100


Eli wrote (to the Clean Discussion List):

>write_graph :: !a -> Bool;
>write_graph g = code  {
>.d 1 0
>        jsr     _print_graph
>.o 0 0
>        pushB TRUE
>}
>
>My clm (1.3, under Redhat 5.2 Linux) rejects this vehemently.

This snippet can be used in a module where you don't use the
layout rule (module header ends with a semicolon). My guess is
that you do use the layout rule.

> Can anyone adjust that code to something it will like?

write_graph :: !a -> Bool
write_graph g = code  {
    .d 1 0
            jsr     _print_graph
    .o 0 0
            pushB TRUE
    }

>This could be turned into a very convenient trace facility.

You can also have a look at the WrapDebug library
<http://www.cs.kun.nl/~clean/Download/Download_Libraries/wrapdebug/wrapdebug.html>.

For users of Clean 1.3.3 and (WrapDebug or StdDebug): there is a
change in the behaviour of trace and debugBefore. The functions
abort and undef from StdMisc are now recognised by the strictness
analyser. The reason is that a function like

    f 1 x
        =   x
    f _ _
        =   abort "f: unexpected case"

will be strict in x, just as in

    f 1 x
        =   x

However, the trace functions depend on a certain evaluation order,
which has been broken by this.

I will update the WrapDebug library next week to fix this.


Cheers,

Ronny Wichers Schreur