Fri Oct 28 16:47:19 EDT 2011

Term = (type-annotated) Scheme?

It seems simpler to continue to relax the representation Term and rely
on the type system to actually limit the possible combinations.
Especially the use of variable references instead of terms in App seem
to be a problem for testing..

Maybe it's even possible to first fully encode Scheme and then build a
restricted interface on top of this?

Anyway we can find that out later.  The only reason I raise the issue
is because the following doesn't work:

t7 = _app (f5 :: C1) $ lit 1

Because there is no direct application of Lambda terms, only function

So let's try Lambda separately.  This one asks for CompileData instance.

-- test Lambda
t9 = unCode (f5 :: C1)

That seems straightforward:

instance Args Code as ras => CompileData ras Term where
  compileData r = ts where
    (Code t) = pack r  
    vs = codeList t
    ts = map Ref vs

Though for CompileVar I don't know.  My first attempt doesn't seem to
work, probably because there is no terminating instance..

instance Args Code as ras => CompileVar ras where
  compileVar r = compileVar t where
    (Code t) = pack r

Next: find out why this pops up here.  This is really for base types,
not for composites.