nowfound

Dev tools · May 25, 2024

Sum (algebraic) types for C in one 100 line header

A mirror of https://git.sr.ht/~grego/sumtypes.h. Contribute to grego/sumtype.h development by creating an account on GitHub.

Sum (algebraic) types for C in one 100 line header launched on May 25, 2024 with 92 votes, #526 of 4,539 launches that month and more than 90% of that year's launches. The site was still online in September 2026, 2 years on.

Visit github.com ↗Alternativestop 12% of May 2024

In plain words

Sum is a C library provided as a single 100-line header file that implements algebraic sum types for the C programming language. It allows developers to create and work with discriminated union types, a feature commonly found in functional programming languages. Sum is designed for C programmers who need structured ways to handle multiple possible data types within a single variable, enabling safer and more expressive code patterns in C projects.

written from the facts on this page · September 2026

Does a similar job

all alternatives →
  • IB
    I built a minimal Forth-like stack interpreter library in C2025 · ▲47

    This weekend I created stacklib.h - a single-header library that brings Forth-style stack operations to C. It implements a basic interpreter with: - Stack operations (push/pop/dup/swap/over/drop) - Arithmetic (+, -, *, /) - Output (., emit, cr) - Stack inspection (.s, depth) Example usage: Stack s; stack_init(&s); dict_init(); exec(&s, "10 20 + ."); // Prints "30" exec(&s, "1 2 3 4 .s"); // Shows stack contents The library is self-contained, requires no dependencies, and handles basic error checking. It was inspired by wanting to understand…

  • Floating point arithmetic types in C++ for any size and any base2024 · github.com · ▲79

    Since there is so much interest on HN in floats lately and their software implementations, I wanted to show mine. It has no use and is just for teaching me floats and C++. Give me your thoughts.

  • An expression parser supporting multiple types2024 · github.com · ▲33

    This C library is part of a main project aimed at providing a reactive key-value (KV) database. The data is typed (numbers, strings, dates, or booleans) and can include formulas with references to other entries. Clients connected to this database receive a real-time data stream with updates to the subscribed keys, allowing them to react to changes and their dependencies. Essentially, it’s like building a distributed Excel, where data and formulas dynamically update across the system. I couldn’t find any libraries that offered the full set of features I needed for evaluating expressions, so I…

  • Poica – Algebraic data types and type introspection for pure C2020 · github.com · ▲116

    Contribute to hirrolot/poica development by creating an account on GitHub.

  • CL
  • A utility for running exhaustiveness checks on “sum types” in Go2017 · github.com · ▲75

    A simple utility for running exhaustiveness checks on Go "sum types." - BurntSushi/go-sumtype

More dev tools this month

the category →
  • /dev/null▲490

    a social network for devs

    Dev tools · 4d ago · dev-null.sh

  • open-source IDE for thoughtful software design. Contribute to devdotfast/whiteboard development by creating an account on GitHub.

    Dev tools · 28d ago · github.com

  • Contribute to reladraw/reladraw development by creating an account on GitHub.

    Dev tools · 26d ago · github.com

  • OpenBot▲362

    Grok Bot alternative: free, local, open-source, multiplayer

    Dev tools · 24d ago · openbot.run

  • Talanoa▲346

    Hi HN, I’m a fullstack developer, and honestly, I’ve lost count of how many side projects I’ve worked on over the years. But one idea kept coming back to me: a different kind of email client. It first came to me in 2014: “What if we could handle emails more like conversations?” Every year, I’d revisit this concept in my “Build Notes.” Ten years later, no one had built exactly what I had in mind — so I finally decided to do it myself. That’s how Talanoa was born. I wanted something focused on people, not timelines. I was tired of marking messages as unread just to remember to reply later, or…

    Dev tools · 21d ago · talanoa.email

  • CoreSpeed▲332

    One MCP for everything your agents need: apps, memory, tools

    Dev tools · 29d ago · corespeed.io

Source: Show HN post ↗

Launched alongside, May 2024

the whole month →
  • Voicenotes▲1,485

    AI note-taker that's truly intelligent

    AI · 2024 · voicenotes.com

  • Wegic▲1,179

    The first AI web designer & developer by your side

    Dev tools · 2024 · wegic.ai

  • Insighto▲1,108

    Ship features users want

    Growth · 2024 · insigh.to

  • Ivee▲1,087

    The B2B influencer marketing platform

    Growth · 2024

  • Waxwing▲1,035

    AI copilot for every marketing task

    AI · 2024

  • AI powered zero-waste meal planner

    AI · 2024 · ohapotato.app