Sun Dec 25 09:44:31 EST 2011

Binder for _unpack

The use of a lambda body is probably overkill:

  _unpack :: (TMLword as, Struct s r as ras) 
             => r as -> (ras -> m (r t))
             -> m (r t)

Can't this be done in a more straightforward way?

  _unpack :: (TMLword as, Struct s r as ras) 
             => r as -> m ras

Yes.  This is the implementation: simply insert Unpack form once the
type is destructured into a collection of variables.

  _unpack = mUnpack

  mUnpack (Code packed) = do
    (vars, unpacked) <- mStruct "a"
    SC $ (\state k -> Unpack vars packed (k state unpacked))
Hmm.. This can probably be generalized to other binding forms that use
explicit lambdas..  Or not.  The only remaining ones are actual
functions, not representations of let-like forms.

Looking good after adding Unpack in PrettyC (CInitList).