Skip to content
0:00 / 0:00

#ghc#haskell#helium

Jurriaan Hage - Domain-Specific Type Error Diagnosis in the Glasgow Haskell Compiler

Curry On!

6.3K subscribers • 21 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2017 to 2023.
  • Presented by Jurriaan Hage

Advanced. Deep dive for people who know the field.

909 views9 years ago2 recommendations

Programming languagesSystems programmingCompilers and interpretersLanguage design and type systems

Jurriaan Hage demonstrates how to improve type error messages for embedded domain-specific languages in Haskell using type-level programming.

Abstract With its advanced type system, the purely functional language Haskell is extremely well-suited for developing applications based on embedded domain specific languages (EDSL) for domains where the quality of software is critical to success (e.g., the financial sector). To the compiler an EDSL is no different from any other library written in Haskell; to the user of the EDSL, it is a library that allows her to express her solution to a problem in her domain. in a syntax (fluency) reminscent of that of the domain. But one problem continues to plague the end users of EDSLs: whenever a type error occurs, the encoding of the domain inside the host language Haskell leaks out in those error message. And this encoding is exactly what the EDSL developers were trying to hide! In this talk we demonstrate how type error diagnosis can be made domain-specific by type level programming. We have implemented this in the Glasgow Haskell Compiler, the industrial-strength compiler for Haskell. With relatively small modifications to the compiler, we can show huge gains in terms of domain-aware type error messages, and suggestions on how to fix a given type error. Our solution has more advantages: existing EDSLs can be easily wrapped with specialized error diagnosis, the wrapping is invisible to the end user, and the soundness of the type system is guaranteed by the compiler. The abstractions provided by type-level programming allow us to describe and reuse common patterns in type error diagnosis, lowering the entry barrier for DSL authors. Bio Dr. Jurriaan Hage is an assistant professor at Utrecht University. His work in programming technology is largely focused on two aspects: the optimisation of functional languages by means of type and effect systems, and type error diagnosis for strongly typed functional languages. He is currently the lead maintainer of the Helium compiler for learning Haskell.

Why it's here

2 people recommend this

What people say. Recommended as an important presentation on improving Haskell's type error messages for domain-specific libraries.

u/agocoronain r/haskell • Recommends

Domain-Specific Type Error Diagnosis in the Glasgow Haskell Compiler

u/Noughtmarein r/haskell • Recommends

On “Haskell in Production: CollegeVine”

They say that the database access was hard because the error messages were very poor when you stray outside the happy path. I would agree with that in general in Haskell that error messages are an afterthought when introducing new abstractions. That's why I think the work of Jurriaan Hage on domain specific error messages in GHC and the Helium Haskell compiler is so important. One of his presentations is on YouTube if you're interested: link to this video