Skip to content

Instantly share code, notes, and snippets.

View dfurmans's full-sized avatar
🍊
SolYNaranjaS

Dawid Furman dfurmans

🍊
SolYNaranjaS
View GitHub Profile
@dfurmans
dfurmans / events.hs
Created December 3, 2023 13:03 — forked from aaronlevin/events.hs
LambdaWorld 2016 & Typelevel Summit 2017 (Copenhagen): Type-Level DSLs // Typeclass induction
-- Our goal is to create a type describing a list of events. This is our
-- type-level DSL.
-- We will then use typeclass resolution to "interpret" this type-level DSL
-- into two things:
-- 1. A comma-separated list of events
-- 2. A method that, when given an event name and a payload, will try to parse
-- that event type with the payload. A form of dynamic dispatching
--
-- To model a list of types we will use tuples. You can imagine the list of
-- types "Int, String, Char" to look like: