Functions are Functors
We are used to treat closures as first class citizens in our code. Same goes to functions as they are interchangeable. But we often don’t think of them as actual types. So they also can play with the rules and abstractions that we usually attach to classes or structs.
So yes, a function of type (I -> O)
is a Functor
struct Function {
let closure: I -> O
func map(f: Function
If you liked this article please consider supporting me