Thu Dec 22 13:54:56 EST 2011

Struct / Tuple

- Abstract the variable generation that's used right now for _lambda
  and _app and map it to a "default flattening destructring bind" ref/unref.

- For PrettyC: map this flat tuple ref/unref to canonically named C

Abstracting the var gen I get this:

mStruct ras = do
  nVars         <- return $ structSize (undefined :: ras)
  varNames      <- nameList "a" nVars
  (argCode, []) <- return $ structVariables (undefined :: ras) varNames
  argVars       <- return $ map unRef (structCompile argCode)
  return $ (argVars, argCode)

The "xxx <- return $ yyy" is to avoid nested do/let constructs.  It's
only the nameList operation that uses the monad state.

Actually this can probably use return type dispatching.