[clean-list] Re: relationship between uniqueness types and single-threaded lambda calculus?

Adam Megacz megacz at cs.berkeley.edu
Mon Jun 4 02:56:58 MEST 2007


Thank you for the example!  Experimenting with changes to it has
helped my understanding.  However, I'm still a bit confused -- though
I have a concrete example now.

This modified version of your program works properly:

  // just to make sure that no auto-tuple-strictification is going on
  ::StrictPair a = Sp !Int !a
  strictPairFst :: (StrictPair a) -> Int
  strictPairFst (Sp x y) = x
  
  // returns a strict pair (a[i],i)
  selectx :: *{Int} Int -> StrictPair Int
  selectx x y = Sp (select x y) y
  
  // this works
  swap :: *{Int} Int Int -> *{Int}
  swap arr i j
      #!
         a = Sp (select arr i) i
         //a = selectx arr i
         b = select arr j
      = (update (update arr i b) j (strictPairFst a))

But if I comment out the definition of "a" and uncomment the line
after it, the compiler says '"arr" demanded attribute cannot be
offered by shared object'.

Aren't the two definitions of "a" equivalent?  Do I need to give a
more specific type for selectx?

I'm just trying to understand the process by which the compiler
figures out the uniqueness of different values.

  - a



More information about the clean-list mailing list