[clean-list] How to define subgraph with type signature?

Vag Vagoff vag.vagoff at ya.ru
Tue Dec 6 21:21:21 MET 2011


Hello!

As Dee Mon (http://thedeemon.com) has noticed that subgraph with type signature always regarded as function.

For example, in

	test1 n = a + a where a = somefunc 0 + 1

'a' is subgraph and computed only once but in

	test2 n = a + a where
             a :: Int
             a = somefunc 0 + 1

'a' regarded as function and computes twice (i.e. no memoization occurs).

Why is and how to coincide this compiler behavior with the language spec?

(Fresh Clean 2.3 installation was used without any modifications)

Sincerely yours,
Vag.

----------------------------------------------------------------

module test

import StdEnv, StdDebug

Start = test 10
test n = a + a where
// a :: Int
     a = somefunc 0 + 1
somefunc n = trace "!" n


More information about the clean-list mailing list