DSLs allow us to express our code in verbs and nouns that describe our domain. This helps keeping business logic clean of implementation specific details, and allows for more readable code. Few languages have support for easily defining DSLs, for example macros in clojure/lisp, metaprogramming in ruby, but these techniques are not portable to other languages. Free monads is a way to convert a functor into monads, and allow us to create a structure for our desired computation, which can be interpreted later. This also allows us to decouple the definition of a DSL from its interpretation. In this talk we explore the use of Free monads to easily define DSLs and their interpreters.


Outline/Structure of the Case Study

  • Introduction
  • Basics
    • What are Functors
    • What are Monads
  • What are Free Monads
  • Describing DSLs with Free Monads
  • Interpreting DSLs with CoFree
  • Composing DSLs together
  • Criteria to consider while defining DSLs
  • Examples

Learning Outcome

  • How to define a DSL
  • How to define interpreters for DSLs using CoFree
  • Composing DSLs and their interpreters
  • Decoupling DSLs from their interpretation
  • How to make programs safer by avoiding IO and using DSLs

Target Audience

Those interested in decoupling business logic from implementaion

Prerequisites for Attendees

The techniques described are independent of the language, but the examples will be presented in Haskell. Working knowledge of haskell basics like types and type classes will be helpful.

schedule Submitted 2 years ago

  • Abhinav Sarkar
    Abhinav Sarkar
    Software Engineer
    schedule 2 years ago
    Sold Out!
    45 Mins

    Easy concurrency is one of the main prophesied benefits of the modern functional programming (FP) languages. But the implementation of concurrency differs widely between different FP languages. In this talk, we shall explore the methods and primitives of concurrency across three FP languages: Haskell, Erlang, and Clojure (with core.async).

    We shall learn about and compare the trade-offs between

    • the green threads and STM channels oriented concurrency of Haskell
    • everything-is-a-process and message-passing actor pattern of Erlang
    • macro-based CSP transformation of Clojure/core.async
  • Kiran Gangadharan

    Kiran Gangadharan / Udit Kumar - The Road to a Masterless Multi-node Distributed System in Elixir

    45 Mins

    In this talk, we will cover our journey from the base to the summit of a masterless multi-node distributed system in Elixir. We’ll talk about the challenges faced, decisions made and how they shaped/evolved the architecture.