Kotlin sample code for Bartosz Milewski's Category Theory for Programmers
Contributions (PR, review, issues) are welcome!
If you are interested, please indicate that you are working on in the respective issues. You can find the issues for each chapter here here.. Feel free to claim an issue you want to work on by adding a comment. Someone will then move it to In progress
in the project board
We discuss Arrow and development of FP in general in Kotlin in the Kotlin Community Slack in the arrow and arrow-contributors channels.
Build the project with:
./gradlew runAnk
Please use 2 spaces to indent your code.
Use ```kotlin:ank:silent``` for code that is compilable, use ```kotlin``` otherwise.
Use a line of .............
to separate between code examples.
If it's a "standalone" function, use the function syntax, i.e.
val f: (A) -> B
If it is inside an interface or class, use the method, i.e.
fun f(a: A) : B
-
The Docs for Λnk without ank:playground
-
If you define / redefine type classes please define them within a playground environment.
```kotlin:ank:playground
import arrow.data.ForListK
import arrow.data.ListK
import arrow.Kind
import arrow.data.fix
import arrow.typeclasses.Functor
interface ListKFunctor : Functor<ForListK> {
override fun <A, B> Kind<ForListK, A>.map(f: (A) -> B): ListK<B> =
fix().map(f)
}
```...
Playground Docs. But for now a basic set-up as the snippet above is sufficient. Remember that ank:playground wont make the code snippet global for other snippets.
-
In some instances (in the context of coroutine examples) Λnk won't process very long (over ~160 lines) md files. Split them up into < chapter >-Part1.md , < chapter >-Part2.md
-
Debug with (optionally add the --stacktrace)
gradle runAnk
This work is licensed under a Creative Commons Attribution 4.0 International License.