Because I don't like that I have to lift and call ...

# arrowd

Derek Berner

03/05/2019, 3:48 PMBecause I don't like that I have to lift and call at the same time. I always end up doing this in my projects to lift constructors:

Copy code

```
fun <FF,A,B,Z> Applicative<FF>.liftA(f: (A,B)->Z): (Kind<FF,A>, Kind<FF,B>) -> Kind<FF,Z> =
{aa, ab ->
ab.ap(aa.map(f.curried()))
}
fun <FF,A,B,C,Z> Applicative<FF>.liftA(f: (A,B,C)->Z): (Kind<FF,A>, Kind<FF,B>, Kind<FF,C>) -> Kind<FF,Z> =
{aa, ab, ac ->
ac.ap(ab.ap(aa.map(f.curried())))
}
fun <FF,A,B,C,D,Z> Applicative<FF>.liftA(f: (A,B,C,D)->Z): (Kind<FF,A>, Kind<FF,B>, Kind<FF,C>, Kind<FF,D>) -> Kind<FF,Z> =
{aa, ab, ac, ad ->
ad.ap(ac.ap(ab.ap(aa.map(f.curried()))))
}
fun <FF,A,B,C,D,E,Z> Applicative<FF>.liftA(f: (A,B,C,D,E)->Z): (Kind<FF,A>, Kind<FF,B>, Kind<FF,C>, Kind<FF,D>, Kind<FF,E>) -> Kind<FF,Z> =
{aa, ab, ac, ad, ae ->
ae.ap(ad.ap(ac.ap(ab.ap(aa.map(f.curried())))))
}
```