[clean-list] Re: relationship between uniqueness types and
single-threaded lambda calculus?
Adam Megacz
megacz at cs.berkeley.edu
Mon Jun 4 23:49:50 MEST 2007
Edsko de Vries <devriese at cs.tcd.ie> writes:
> I am not sure what is going on here; maybe somebody else what to
> jump in here?
Here's another example. Apparently the compiler likes some return
types and doesn't like others (see below).
I think it's using the knowledge that "an Int:::Int cannot capture a
reference to the argument, but a Int:::(a->a) can, and an Int:::{Int}
can". This doesn't seem like a good thing (if it is the case) -- it
seems like this would limit polymorphism. What's missing is a way to
talk about capturing the argument (or not) without restricting the
allowable set of return types.
Feedback would be greatly appreciated.
- a
::StrictPair a b = (:::) !a !b
sfst (x ::: y) = x
select_ :: {Int} Int a -> StrictPair Int a
select_ arr idx dummy = (select arr idx) ::: dummy
swap :: *{Int} Int Int -> *{Int}
swap arr i j
#! a = select_ arr i dummy
b = select arr j
= (update (update arr i b) j (sfst a))
dummy = 3 // <--- works
// dummy = {3} // <--- does not work
// dummy = \x->x // <--- does not work
More information about the clean-list
mailing list