
Roman Leshchinskiy wrote:
apfelmus wrote:
Ah, right. But unlike size , this is unambiguous since t can (and probably should) be fused away:
hylo :: Functor f => (f s -> s) -> (p -> f p) -> p -> s hylo f g = f . fmap (hylo f g) . g
Excellent point! When I originally developed the code, type functions didn't really work anyway. I'll try again now that they are more mature.
Actually, I don't think that hylo :: Fixpoint f t => (f s -> s) -> (p -> f p) -> p -> s hylo f g = cata f . ana g will typecheck, the t is still ambiguous. It's just that it's one of those cases where the type signature is ambiguous but the program isn't. Well, from a denotational point of view anyway, different t will generate different code for hylo . Regards, apfelmus