[Haskell-cafe] Can't Haskell catch upwith Clean's uniqueness typing?

Robin Green greenrd at greenrd.org
Tue Dec 6 18:39:05 EST 2005


On Tuesday 06 December 2005 21:00, haskell-cafe.mail.zooloo at xoxy.net wrote:
> In Clean, you can (and often are required to) assign uniqueness attributes
> to some parts of a function's type signature. The extended type checker
> ensures that none of those parts is referred to more than once during a
> single run of the program. Based on this guarantee, a function does not
> have to allocate new memory at all to store a unique result but can
> overwrite the unique arguments in place.

The rough equivalent to this in Haskell would be ST and STRefs, I believe. 
They work somewhat differently, however.

> My question is - and this might better suit to Haskell -, can't uniqueness
> be inferred (and exploited) automatically in many cases?

I'm not sure that uniqueness is the right thing to focus on here. I see this 
suggestion as a special case of situations where the compiler can know that a 
value will never be needed after a certain point, and therefore it can be 
free'd instead of being garbage collected (I don't know the technical term 
for that). These situations are - surely - not limited to situations where 
the value is referred to only once.

-- 
Robin


More information about the Haskell-Cafe mailing list