Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kotlincraft/arrow-parmap-example

Structured Concurrency in Kotlin using Arrow's parMap
https://github.com/kotlincraft/arrow-parmap-example

arrow functional kotlin

Last synced: 22 days ago
JSON representation

Structured Concurrency in Kotlin using Arrow's parMap

Awesome Lists containing this project

README

        

This document is the example project for the following blog post: [Structured Concurrency in Kotlin using Arrow's `parMap`](https://kotlincraft.dev/articles/structured-concurrency-in-kotlin-using-arrows-parmap).

# Arrow Example: Structured Concurrency with `parMap`

## Overview

This project is a Kotlin-based application that showcases examples of structured concurrency with Arrow.

## Building the Project

To build the project, you need to have Gradle installed. You can build the project using the following command:

```sh
./gradlew build
```

## Running the Tests

To run the tests, use the following command:

```sh
./gradlew test
```

## Project Structure

### Main Classes

- **UserService**: A service class that simulates API calls to fetch user details and user posts. It includes methods to fetch a user and their posts with simulated network delays.

### Data Classes

- **User**: Represents a user with an ID and a name.
- **UserPosts**: Represents a user's posts with a user ID and a list of posts.
- **EnrichedUser**: Represents an enriched user with user details and their posts.

### Test Classes

- **UserServiceTest**: A test class that uses Kotest to test the `UserService` class. It includes a test case to verify the generation of user IDs and concurrent processing of users with `parMap`.

## License

This project is licensed under the MIT License.
```