Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kotlincraft/arrow-parmap-example
- Owner: KotlinCraft
- Created: 2024-12-30T19:59:43.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-31T10:40:16.000Z (about 1 month ago)
- Last Synced: 2025-01-01T09:10:48.910Z (about 1 month ago)
- Topics: arrow, functional, kotlin
- Language: Kotlin
- Homepage: https://kotlincraft.dev/articles/structured-concurrency-in-kotlin-using-arrows-parmap
- Size: 180 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.
```