Skip to content

Runtime error running function with seqs and tracing. #10

@rdwebster

Description

@rdwebster

The following error occurs when executing the CAL function below (with any argument value):

java.lang.UnsupportedOperationException: Attempt to call 'f' on:
org.openquark.cal.internal.runtime.lecc.RTData$CAL_Int, Detail: Attempt to call 'f' on: org.openquark.cal.internal.runtime.lecc.RTData$CAL_Int

test :: Int -> String;
test !unused = 
    let
        val1 :: Int;
        val1 = 0;

        val2 :: Int;
        val2 = 
Debug.traceShowable "val2 = " $
            1;

        result :: String;
        result = 
            if val2 == 0 then
//            if val1 + val2 == 0 then  // Same problem with this.
                "abc"
            else 
                "def";
    in
Debug.traceEvalStartAndEnd "test" (
        val1 `seq`
        val2 `seq`
        result
)
        ;

This is a simplified version of a function which was using seq to control the execution order due to side-effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions