# Functor, Monad, Applicative in Swift

Some Implementation in Swift.

### Functor

Let $C$ be a constructor which takes a variable as parameter.

$C$ is a Functor if $C$ has the following ability.

For example, we can write such a function map for Optional. (Well, swift already has such built-in function.)

And we can chain functors like this.

We can also do it like Haskell

$C$ is a Monad if $C$ has the following ability.
$C$ is a Applicative if $C$ has the following ability.