[clean-list] type reporting

Ronny Wichers Schreur ronny@cs.kun.nl
Wed, 17 Dec 2003 10:43:20 +0100


Jerzy Karczmarczuk writes (to the Clean Discussion list):

> fractnoise kappa nstages seed = fr seed where
>   fctr = 0.5^kappa
>   fr seed
>     # (l,seed) = midpoint [#0.0,0.0] 1.0 nstages seed
>     = l ++| fr seed
>   midpoint l _ 0 seed = (l,seed)
>   midpoint (xs=:[#x0:xq]) amp n seed
>     #! (l1,seed) = mdsp xq xs [#x0] amp seed
> ...............
>
> and the type inferrer reports:
>
> midpoint :: Real u:[#Real] Real !Int Int
>                    -> (v:[#Real],Int), [u <= v]
>
> For goodness' sake, the function midpoint accepts 4
> parameters, not 5.  What the first Real is doing there?
> The first argument is a list.

The function midpoint uses fctr. The reported type includes
this lifted argument.

> map_ :: (u:a -> v:b) !w:(c u:a) -> x:(d v:b)
>                | List; c a & List; d b, [w <= u,x <= v]
>
> Why this semicolon after List? It is not accepted by
> the compiler.

That's a bug.

In Clean classes and (record) types are in different name
spaces, but during the translation a dictionary record type
is associated with each type. The semicolon is there to
prevent a name clash, but we forgot to remove the semi-
colon in the "List all types" output.


Cheers,

Ronny Wichers Schreur