Typical business apps store structured data, transform it and send it hither and thither. They are typically made of multiple components that have to agree on the schema of the data they exchange. So a large part of what it means to be "flexible" is for it to be easy to modify and extend the schema of the data that the system handles.
Strong typing can help with this, ensuring that the code that accesses the data is consistent with the schema. One idea that has been tried with databases is to generate Haskell types from the database schema, or generate the database schema from the Haskell types, or both from some standalone schema.
In this talk we will describe how we have applied this same idea but for REST APIs. We have a DSL that we use to specify the schema of the data available via a REST API. With a machine description of the schema we can generate the code and documentation for many parts of the system, and of course those parts are then easily adaptable when the schema changes. We generate Haskell types, JSON conversion functions, REST API documentation, disk persistence and more. We also have a story for managing schema changes and migrating data. This system is in use at Iris Connect and is now available on Hackage.
This talk will also discuss further applications we have found for these tools and some of the experience from the development project at Iris Connect, including problems we have had to solve building the Haskell components of the system and the wider challenge of integrating it into the overall development project.
YOU MAY ALSO LIKE:
- Why Regular Expressions Matter with Chris Dornan! (SkillsCast recorded in May 2017)
- Haskell Fundamentals (2-Day Course) with Alejandro Serrano (Online Course on 5th - 6th July 2021)
- Haskell eXchange 2021 (Online Conference on 16th - 17th November 2021)
- Why An API Story? (SkillsCast recorded in June 2021)
- Abstract Fun-sense: a functional perspective on life (SkillsCast recorded in May 2021)