Git Product home page Git Product logo

tyranny-of-types-type-classes's Introduction

Comparing Haskell's Type Classes to Rust's Traits and OCaml's Modules

This Repository holds a paper I wrote in 2022 for a Bachelor-Seminar at TUM called "Tyranny of Types". The topic I was given was called "Type Classes" and I ended up writing a comparison of Haskell's Type Classes, Rust's Traits and OCaml's Modules. A web-version of the paper with small differences can be found here.

Abstract

There are many ways to abstract functionality in programming languages. One important idea of abstraction is the notion of interfaces defining functionality for abstract types. Modern languages offer different approaches to such interfaces, some focus on data abstraction, while others focus on supporting ad-hoc polymorphism. We will see the differences between parametric and ad-hoc polymorphism. Furthermore we will look at three approaches to the concept of interfaces: Haskell type classes, the type class-inspired Rust traits and OCaml's ML-inherited module system, and find them to have many similarities.

Info

For the actual submission, I was given a page limit because of which I had to leave out some sections. The sections are currently not left out, but you will find them marked with comments in the latex source. The submission-version of the paper can be found with the "deadline-paper" git tag.

I originally started writing the paper with Markdown and mdBook and then translated it over and did further edits in latex. I then re-translated those changes back into mdBook. Thus there is a latex and a mdbook folder in this repository. Both versions are almost identical, with some small tweaks and a little more code in the mdBook version.

I also had to hold a presentation about the topic, the slides for which can be found in the presentation folder. They are written in LaTeX with beamer and use TUM's design template. There are no notes or the likes and the slides themselves aren't very useful as the actual presentation was mostly freestyle.

Later in 2024 I found out about Typst and translated this paper into it to try it out. The result can be found in the typst folder.

Build

To build the LaTeX paper or presentation, use just:

cd latex # or presentation
just

To build the mdBook, you'll need to install mdbook-katex, then build the book:

cargo install mdbook-katex
cd mdbook
mdbook build

To build the Typst paper:

cd typst
typst compile main.typ

tyranny-of-types-type-classes's People

Contributors

treeniks avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.