Arrow: Request documentation about concepts of the FP ladder in Arrow

Created on 17 Nov 2019  路  7Comments  路  Source: arrow-kt/arrow

What version are you currently using?

LATEST

What would you like to see?

When you are trying to review the first 2 levels of the Open ladder of functional programming using Kotlin and Arrow, I don麓t find many examples in the documentation about the following topics:

  • arrow.syntax.function.curried
  • arrow.core.andThen
  • arrow.syntax.function.compose
  • arrow.syntax.function.forwardCompose
  • arrow.syntax.function.memoize
  • arrow.syntax.function.partiallyX

Steps:

Juan Antonio

docs enhancement help wanted noob friendly

Most helpful comment

Oki, next week I will start from the first feature where Arrow add some features

Level 1
 - Immutable Data
 - Second-Order Functions
 - Constructoring & Destructuring
 - Function Composition <-- Starting point
 - First-Class Functions & Lambdas

Files affected:

  • arrow.core.andThen
  • arrow.syntax.function.compose
  • arrow.syntax.function.forwardCompose

Juan Antonio

All 7 comments

These came mostly from funktionale before Kategory and funktionale merged into Arrow and nobody has taken the time to document those. @jabrena Feel free to take on it if you want, descriptions for what these functions do are everywhere in the internet

Oki, next week I will start from the first feature where Arrow add some features

Level 1
 - Immutable Data
 - Second-Order Functions
 - Constructoring & Destructuring
 - Function Composition <-- Starting point
 - First-Class Functions & Lambdas

Files affected:

  • arrow.core.andThen
  • arrow.syntax.function.compose
  • arrow.syntax.function.forwardCompose

Juan Antonio

See also #802

Working on the issue.

Initial documentation process for file: composition.kt

package arrow.syntax.function

inline infix fun <P1, P2, IP, R> ((P1, P2) -> IP).andThen(crossinline f: (IP) -> R) = forwardCompose(f)

inline infix fun <P1, IP, R> ((P1) -> IP).andThen(crossinline f: (IP) -> R): (P1) -> R = forwardCompose(f)

inline infix fun <IP, R> (() -> IP).andThen(crossinline f: (IP) -> R): () -> R = forwardCompose(f)

inline infix fun <P1, P2, IP, R> ((P1, P2) -> IP).forwardCompose(crossinline f: (IP) -> R) = { p1: P1, p2: P2 -> f(this(p1, p2)) }

inline infix fun <P1, IP, R> ((P1) -> IP).forwardCompose(crossinline f: (IP) -> R): (P1) -> R = { p1: P1 -> f(this(p1)) }

inline infix fun <IP, R> (() -> IP).forwardCompose(crossinline f: (IP) -> R): () -> R = { f(this()) }

inline infix fun <IP, R, P1> ((IP) -> R).compose(crossinline f: (P1) -> IP): (P1) -> R = { p1: P1 -> this(f(p1)) }

Good morning,

What is the difference between: AndThen from arrow-core:
https://arrow-kt.io/docs/apidocs/arrow-core-data/arrow.core/-and-then/index.html

and andThen from arrow.syntax.function?

What is the recommended way to use the functional composition in Arrow?

I have the impression that exist a way from the merge process from funktionale
https://github.com/MarioAriasC/funKTionale/blob/master/funktionale-composition/src/main/kotlin/org/funktionale/composition/namespace.kt

and another way from the package arrow.syntax.function.

I need the clarify what is the recommended way.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JorgeCastilloPrz picture JorgeCastilloPrz  路  3Comments

AntonioMateoGomez picture AntonioMateoGomez  路  4Comments

JorgeCastilloPrz picture JorgeCastilloPrz  路  3Comments

raulraja picture raulraja  路  4Comments

Northburns picture Northburns  路  4Comments