IHP: A Haskell Framework for Type-Safe Web Applications

Integrated Haskell Platform (IHP) is a batteries-included web development framework created by digitally induced for building type-safe web applications in Haskell.

Recently, I got the chance to interview Marc Scholten, the CEO of digitally induced. We talked about the framework, their choice of Haskell and Nix as technologies, and how IHP can be an accessible choice for Haskell beginners.

Interview with Marc Scholten

Could you briefly introduce Integrated Haskell Platform (IHP) to our readers?

IHP is a full-stack framework for building type-safe web applications with Haskell. It comes with everything you need to develop full-featured web apps. IHP is designed to be used by non-Haskellers and people just beginning their Haskell journey.

How did you come to the thought of building a web framework? Was it connected to the main business of digitally induced?

We develop a wide range of complex software solutions for our clients at digitally induced. Moving through the software lifecycle, we could see certain problems happen again and again. Specifically, quality issues when working with untyped languages and issues related to package management happened repeatedly across projects. This led us to look for solutions in the Haskell space. Existing solutions didn’t fit our requirements: being batteries included, beginner- friendly, and well documented. So we slowly started building IHP.

What were the reasons for writing IHP in Haskell? Are there any clear benefits?

Web-based software typically changes a lot across its lifetime. Haskell provides a best-in-class type system. The type system helps to make sure that all changes can be applied without breaking existing features.

One example: We worked with Rails in the past. Sometimes, the focus of software projects shifts, and you need to make changes to the core data structures underlying the application. In Rails, after months in the project, it gets very expensive to make these kind of changes. It’s likely you will break other unrelated features, so you need to test a lot.

This incentivizes not refactoring core data structures after a project has been started, even if it would be better for the project overall because the focus is shifting.

With Haskell’s type-system, you’re very confident in making major changes at any point in the project lifecycle.

So Haskell is a great fit for the kind of fast-changing web applications we’re building.

Are there any specific features of Haskell that make it a great choice for web development?

Type safety and its functional design. There’s a large trend in the software industry to move to more type-safe technologies everywhere, simply because it works better. It’s the same for functional design – Java has lambdas now. :-)

In both of these dimensions, Haskell is best-in-class.

As I see, you also use Nix in the framework. While it’s not an altogether unconventional choice for Haskell projects, could you tell us about your reasons for using it?

We want our developers to be able to switch between different projects very quickly. Nix allows us to standardize our development environments completely. The goal is that you can clone a repository and be ready to start working on it with one command.

This path later turned into also bundling Postgres into the development environment. This opened the door for all the web-based development tooling we provide in IHP.

While initially not our primary goal, it turns out Nix also helps with another problem: We have several projects that are sometimes running for years without any changes. Thanks to Nix, we can still safely build these projects if we need to make small changes at some point. We have years-old projects that are mostly npm-based, and we’re sometimes unable to make any changes to the projects without doing major upgrades.

What are the differences between IHP and the other available Haskell web frameworks like Yesod, Servant, and others?

IHP is designed to be used by developers that are not very familiar with Haskell yet.

Frameworks like Servant and Yesod put many decisions on the developer building the application. This can be useful when you already have experience with the language and the ecosystem.

If you’re trying out Haskell for the first time, it’s quite challenging to decide which database library to pick, which view library is suitable for your project, and how to lay out the modules of your project. You will feel like you’re not going anywhere and stop your Haskell journey before it’s even really starting.

In IHP we’ve made many of these decisions for you. It’s all integrated. When you can build your first small CRUD Haskell app in minutes and get something visual on the screen instead of spending time learning about different library choices, you’re going to have a much better and easier time starting out.

Which kind of developers should think about using IHP as their main web framework?

IHP is good for anyone looking for the high velocity of Rails and Django combined with best-in-class type safety of Haskell.

IHP is now the largest, most active, and fastest-growing web framework in the Haskell ecosystem. So it can also be a good choice if you’re already familiar with Haskell and its ecosystem and want to use the tools that have the most traction.

Have you seen non-Haskellers use the framework as well? Are you not scared that a connection with Haskell could hurt future adoption?

I think the majority of people in the IHP community are not typical Haskellers. Many reviews on the IHP G2 profile tell the story of a developer learning Haskell by building with IHP.

I’m not worried about connections with Haskell. Haskell is still unpopular enough that most developers have never heard of it. It’s like Ruby before 2004.

If a person wants to try out IHP, where should they go to learn more?

Start by watching the demo video at https://ihp.digitallyinduced.com/. Then follow the Getting Started Guide on the Website to build your first own project (and even ship it to production with IHP Cloud if you want to get the full experience).

Do you have any tips for non-Haskellers that want to try out the framework?

Ignore the fancy-named terms, you can learn Haskell the fastest by building software.

I’d like to thank Marc for spending the time to answer our questions, and wish him the best of luck in making Haskell a more accessible language for building web applications.

If you would like to read more articles like these, head to our interview section or follow us on Twitter to receive updates whenever we publish a new one.

Serokell offers a wide range of services as a specialized Haskell IT agency. Discover how we can help.

Haskell courses by Serokell
More from Serokell
How to Write TypeScript Like a Haskeller imageHow to Write TypeScript Like a Haskeller image
Uncaught exception handlingUncaught exception handling
optimizing k frameworkoptimizing k framework