Uniqueness annotations

Richard A. O'Keefe ok@atlas.otago.ac.nz
Tue, 2 Mar 1999 13:44:54 +1300 (NZDT)


	> From
	>     next_random_list ::    !(!(RNG_State -> *(b,RNG_State))
	>                              !Int !RNG_State -> *(*[b], RNG_State)
	>     (next_random_list f n) :: !RNG_State -> *(*[Real], RNG_State)    
	>     m ::                     !Int
	>     s ::                          !RNG_State
	> I expect
	>     next_random_list (next_random_list f n) m s :: *(*[*[Real]], RNG_State)
	> 
	> But that's not what I get.  What I get is an error message.

	Is this sort of type inference supposed to work even though you
	don't provide a uniqueness variable (`.b' or `u:b' instead of
	just `b' in the type declaration of next_random_list)?

I seem to have misunderstood the Clean reference manual.
I _thought_ that if I didn't put a uniqueness variable in front of a
type, it as as if I _had_, so that

    next_random_list :: !(!RNG_State -> *(b, RNG_State)
                        ) !Int !RNG_State -> *(*[b], RNG_State)

was identical in effect to

    next_random_list :: !(!RNG_State -> *(u:b, RNG_State)
                        ) !Int !RNG_State -> *(*[u:b], RNG_State)

but if I understand what you're saying, _each_ occurrence of an
unqualified type variable gets a _different_ type variable, so that
it's really like

    next_random_list :: !(!RNG_State -> *(u:b, RNG_State)
                        ) !Int !RNG_State -> *(*[v:b], RNG_State)

That would explain it.  Thanks.  That does mean that I'm going to
need a lot of uniqueness variables I thought I could do without.