apply1 : (a -> b) -> Foo a -> b apply2 : (a -> b -> c) -> Bar a b -> c apply3 : (a -> b -> c -> d) -> Baz a b c -> d
As you see there is a repeating pattern, we obtain a function and a data structure, then we apply that function and return its result...
Is it possible to abstract over this pattern with Pattern Calculus?
How would the definition for generic
apply look like?