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

https://github.com/r8vnhill/algebraic-data-types-kt

Kotlin examples demonstrating algebraic data types (data class and enum class) as part of the DIBS course on software library design.
https://github.com/r8vnhill/algebraic-data-types-kt

algebraic-data-types data-class dibs-course educational enum-class gradle jvm kotlin software-library type-safe

Last synced: 24 days ago
JSON representation

Kotlin examples demonstrating algebraic data types (data class and enum class) as part of the DIBS course on software library design.

Awesome Lists containing this project

README

          

# πŸ“¦ Algebraic Data Types in Kotlin

![Kotlin](https://img.shields.io/badge/kotlin-2.2.0-7F52FF?logo=kotlin)
![Gradle](https://img.shields.io/badge/build%20tool-gradle-02303A?logo=gradle)
[![License](https://img.shields.io/badge/license-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
![Platform](https://img.shields.io/badge/platform-JVM-orange)
[![Educational](https://img.shields.io/badge/purpose-educational-yellow)](https://dibs.ravenhill.cl)
[![Status](https://img.shields.io/badge/status-stable-brightgreen)]()
[![DIBS Site](https://img.shields.io/badge/website-dibs.ravenhill.cl-purple)](https://dibs.ravenhill.cl)

This repository accompanies the lessons on algebraic data types from the **DIBS** course (Design and Implementation of Software Libraries).

It includes runnable Kotlin examples demonstrating how to model both **product types** (with `data class`) and **sum types** (with `enum class` and `sealed`) in idiomatic and safe ways.

>[!note]
> While the course is taught in Spanish, **all code and project content is in English** to encourage accessibility and reuse.

## πŸ“– Table of Contents

- [πŸ“¦ Algebraic Data Types in Kotlin](#-algebraic-data-types-in-kotlin)
- [πŸ“– Table of Contents](#-table-of-contents)
- [πŸŽ“ Related Lessons](#-related-lessons)
- [πŸ§‘β€πŸ’» Getting Started](#-getting-started)
- [Requirements](#requirements)
- [Clone the Repository](#clone-the-repository)
- [πŸ›‘οΈ License](#️-license)
- [🌐 DIBS Website](#-dibs-website)

## πŸŽ“ Related Lessons

Explore the full lessons on the DIBS course site:

* πŸ“„ [Product types with `data class`](https://dibs.ravenhill.cl/docs/type-fundamentals/algebraic-data-types/records-2/kt/)
* πŸ“„ [Sum types with `enum class`](https://dibs.ravenhill.cl/docs/type-fundamentals/algebraic-data-types/enums/kt/)
* πŸ“„ [Advanced modeling with enumerations](https://dibs.ravenhill.cl/docs/type-fundamentals/algebraic-data-types/idiom-enum/kt)
* πŸ“„ [Sum types with `sealed interface`](https://dibs.ravenhill.cl/docs/type-fundamentals/algebraic-data-types/sealed-interfaces/kt)

Each lesson includes motivation, idiomatic use cases, and annotated code examples designed to help you apply ADTs in real Kotlin libraries.

More lessons will be linked as the course progresses.

## πŸ§‘β€πŸ’» Getting Started

### Requirements

- Java 11 or newer
- [Gradle](https://gradle.org/) (optional β€” a wrapper is included)
- Recommended: [IntelliJ IDEA](https://www.jetbrains.com/idea/)

> For installation help, see the [setup guide](https://dibs.ravenhill.cl/docs/installation).

### Clone the Repository

```bash
git clone https://github.com/r8vnhill/algebraic-data-types-kt.git
cd algebraic-data-types-kt
```
## πŸ›‘οΈ License

This project is licensed under the **[BSD 2-Clause License](./LICENSE)**.

You may use, adapt, and share this code freely for personal, academic, or educational purposes, as long as attribution is given.

## 🌐 DIBS Website

The full course β€” *DiseΓ±o e ImplementaciΓ³n de Bibliotecas de Software* β€” is available at:

πŸ‘‰ [https://dibs.ravenhill.cl](https://dibs.ravenhill.cl)

There you'll find complete lessons, slides, exercises, and complementary resources (in Spanish).