Mon Dec 5 20:30:12 EST 2011
Types are too complex
This doesn't want to infer:
f8 arr = \f ->
_lambda $ (\(accu :: r Tint,
index :: r Tint)
v <- _get arr index
index' <- add index (lit 1)
accu' <- add accu v
cond <- eq index' (lit 10)
(_app f $ accu' index'))
I think it's at least typable. This should really just work. The
following doesn't even infer correctly and needs a pin down to avoid
occurs check error.
f7 :: (StructPair (,) r,
StructPrim s (r a),
Loop s m r)
=> m (r ((a,a) -> m a))
f7 = _lambda $ \(a,b) -> _ret a
I think the problem lies with functional dependencies. I don't really
quite understand how they work. I don't understand the error messages
and I simply get stuck.
Fiddling with the code a bit usually makes it work after a while, but
that's really no way to do programming ay?
Maybe type families are the solution?
Summary: I believe the recursive class definitions for nested tuples
(see Struct), and the fundeps used there, mess things up. They
probably express something else than I intend..