• Stars
    star
    102
  • Rank 323,886 (Top 7 %)
  • Language
    Shell
  • Created over 5 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kotlin sample code for Bartosz Milewski's CT for Programmers

Kotlin sample code for Bartosz Milewski's Category Theory for Programmers

Build Status

Contributing

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

Spaces and indentation

Please use 2 spaces to indent your code.

Type-check your code

Use ```kotlin:ank:silent``` for code that is compilable, use ```kotlin``` otherwise.

Use a line of ............. to separate between code examples.

functions vs. methods

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

Λnk

  • 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.core.ForListK
import arrow.core.ListK
import arrow.Kind
import arrow.core.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)

   ./gradlew runAnk

Initial drafts 🎉

Now there are initial drafts for the missing sections!

It's only necessary to add the translation in Kotlin after the existing snippets in Haskell.

Pick the draft from drafts directory and move it to src/main/ank directory to be considered when building the project.

Even the hypothetical file for Scala is included as a help in drafts/scala so it's possible to add the translation in Kotlin with more information:

Screenshot of meld

Please, note that each snippet has ```kotlin:ank:silent``` by default. Replace it by just ```kotlin``` or ```kotlin:ank:playground``` for different purposes according to this documentation.

License

CC image

This work is licensed under a Creative Commons Attribution 4.0 International License.

More Repositories

1

arrow

Λrrow - Functional companion to Kotlin's Standard Library
Kotlin
5,969
star
2

arrow-meta

Functional companion to Kotlin's Compiler
Kotlin
389
star
3

arrow-core

Λrrow Core is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
81
star
4

suspendapp

Reason about resource-safety in the same way you reason about Structured Concurrency with SuspendApp!
Kotlin
68
star
5

arrow-fx

Λrrow Fx is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
64
star
6

arrow-meta-examples

Some examples for Λrrow Meta the functional companion to Kotlin's Compiler & IDE.
Kotlin
58
star
7

ank

ΛNK: Compile time docs verification and evaluation for Kotlin and Java (Temporarily moved to Arrow-kt)
CSS
53
star
8

backend-arrow-example

Example of Arrow features in the context of a Ktor project
Kotlin
37
star
9

arrow-exact

Arrow Exact exposes a variation of exact types to work with in Arrow. It includes some boilerplate for commonly defined value class wrappers.
Kotlin
29
star
10

arrow-analysis

Arrow Analysis Plugin
Kotlin
27
star
11

arrow-integrations

Λrrow Integrations is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
26
star
12

arrow-check

Λrrow Check - Property based testing in Kotlin - It's part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
25
star
13

arrow-endpoint

Arrow Endpoint offers a composable Endpoint datatype, that allows us easily define an Endpoint from which we can derive clients, servers & documentation.
Kotlin
24
star
14

arrow-meta-prototype

Kotlin
23
star
15

arrow-optics

Λrrow Optics is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
20
star
16

arrow-incubator

Λrrow Incubator is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
20
star
17

arrow-gradle-config

Kotlin Gradle plugins for conveniently setting up Kotlin projects (JVM/MPP), publishing, Dokka, etc
Kotlin
14
star
18

Arrow-MPP-Template

A template project for Arrow on MPP. It defines an application and a couple small examples
Kotlin
14
star
19

arrow-media

Media blog for the functional companion to Kotlin's Standard Library
SCSS
13
star
20

arrow-ank

Λrrow Ank is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
13
star
21

arrow-website

This is the main website for Arrow, the functional companion to Kotlin's Standard Library
Kotlin
10
star
22

arrow-proofs

Arrow Proofs Plugin
Kotlin
10
star
23

fpcollections

Fast immutable collections
8
star
24

arrow-collections

A shared interface for immutable collection libraries
Kotlin
8
star
25

arrow-ui

Λrrow UI is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
8
star
26

arrow-examples

Λrrow Examples is part of Λrrow, a functional companion to Kotlin's Standard Library
Kotlin
7
star
27

cork

A library for Typed Functional Programming in Dart
Dart
7
star
28

Arrow-JVM-Template

A template project for Arrow on JVM. It defines an application and a couple small examples
Kotlin
7
star
29

rewrite-arrow

OpenRewrite recipes for Arrow 1.2.0-RC / 2.0.0
Java
6
star
30

arrow-tracing

Distributed Tracing for Kotlin
Kotlin
6
star
31

arrow-art

Λrrow design assets
5
star
32

Arrow-JS-Template

A template project for Arrow on JS. It defines an application and a couple small examples
Kotlin
5
star
33

arrow-reflection

Kotlin Compile time reflection
Kotlin
5
star
34

arrow-inject

Kotlin
5
star
35

arrow-android

Kotlin
4
star
36

meta

Arrow Meta
Kotlin
4
star
37

arrow-typeproofs

Playground for typeproofs and migration
Kotlin
4
star
38

arrow-context

4
star
39

arrow-test

Kotlin
2
star
40

arrow-site

Λrrow Site is part of Λrrow, a functional companion to Kotlin's Standard Library
Shell
1
star