Haskell Web Framework IHP Aims to Make Web Development Type-Safe and Easy

栏目: IT技术 · 发布时间: 4年前

内容简介:Created atIHP is based on Warp Web server and uses an ORM as its persistence layer. IHP uses nix to simplify the installation process, including its integrated database, compiler, and development environment. Digitally induced claims you can build your fir

Created at digitally induced , the Integrated Haskell Platform aims to be an opinionated framework bringing Haskell type-safety to server side rendering combined with fast development.

IHP is based on Warp Web server and uses an ORM as its persistence layer. IHP uses nix to simplify the installation process, including its integrated database, compiler, and development environment. Digitally induced claims you can build your first web application using IHP in 20 minutes, thanks also to IHP Code Generator, which aims to give you a jump start with Haskell code, and Database Schema Designer. IHP uses its own HTML markup DSL, which is called HSX in analogy with React JSX, but which is transformed to type-checked Haskell code as a previous step to HTML generation.

InfoQ has spoken with digitally induced CEO Marc Scholten to learn more about IHP.

InfoQ: Can you explain what was the main motivation behind IHP creation?

Marc Scholten: At digitally induced we develop many complex software solutions with our clients and partners. While working through the software lifecycle we could see certain problems happen over and over. Especially quality issues when working with very dynamic languages and issues related to package-management. So we set out to solve these problems.

While a lot of people think that the choice of programming languages does not matter, we believe that technology choices vary in power and have a strong impact on the product. We have looked at a lot of different technologies and found Haskell to be a great fit for our aim of highest quality software engineering and developer happiness.

While Haskell is a great language, we could not find a really good framework to work with. We have been looking for something opinionated, well documented, and easy to get started with. After evaluating some solutions we decided to build it ourselves.

The same process lead us to pick nix as our primary package management solution: We want our developers to be able to switch projects very quickly. We intended to make a completely standardized development environment. You should be able to clone a project and be ready to start it with a single command. We aimed to get rid of everything that needed to be done manually. The Nix package manager was just the right tool to make this possible.

InfoQ: IHP strives away from the recent and ever more common approach of generating your UI inside the browser, relying instead on server-side rendering. How do the two approaches stack up against each other in your view? What are their benefits and downside?

Scholten: There is certainly a case for single-page applications. For example when doing very interactive things, like web-based 3D tools or when working with interactive charts.

What we see right now is that a lot of developers choose to build single-page applications without thinking about the costs and tradeoffs. Single-page applications take a lot more effort to develop because additionally to handling the application state in your backend, you also need to do all of the state handling at the client. Obviously, this leads to a lot more code. And therefore more code to maintain. This leads to a lot more bugs and slowed down application development.

In our experience, many applications built right now as an SPA could be built faster and more stable as a server-side rendered application. The recently launched hey.com is a great example: the application is very interactive, yet it’s not a single-page app.

When you have a specific part of your application that is very dynamic and cannot be implemented as a server-rendered application, you can still build a small encapsulated SPA just for that specific page. This hybrid approach has worked very well for us and we believe that this is the way forward in building great web applications.

InfoQ: Which advantage does Haskell bring to the web development, in your experience?

Scholten: In practice the biggest advantage of Haskell is type-safety. Compared to e.g. NodeJS, this results in significantly fewer bugs per LOC. We practically have no runtime errors. And when it’s time to make big changes, you can easily refactor your Haskell application without breaking anything. This helps a lot when you are building new features at a fast pace. We evolved from moving fast and breaking things to just moving fast.

Many programming language ecosystems are moving into the direction of more type-safety, e.g. with TypeScript or the recent developments in the PHP world. We have worked with a lot of different technologies, and nothing really compares to Haskell in this aspect.

InfoQ: What is IHP level of maturity and production-readiness?

Scholten: IHP is already used in production by digitally induced and our partners. The overall application architecture of IHP has been refined in many iterations before we have open-sourced the framework. Additionally, IHP is built on top of battle-tested Haskell libraries, such as the warp web server. Therefore you can expect this to be pretty stable and scalable for large projects already.

IHP has been described as Haskell on Rails by Haskell engineer Matt Parsons on Twitter. While criticizing a few design decisions in IHP, Parsons considers it a useful endeavour:

It's fresh energy in the ecosystem with a strong focus on developer experience. It's a Rails port, which we don't have and we could definitely use. It opens the door for Haskell in other places.

IHP is available on most operating systems, including macOS, Linux variants, and Windows via its Linux Subsystem. You can get it on GitHub .


以上所述就是小编给大家介绍的《Haskell Web Framework IHP Aims to Make Web Development Type-Safe and Easy》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

敏捷估计与规划

敏捷估计与规划

[美] Mike Cohn / 宋锐 / 清华大学出版社 / 2007-7 / 39.90元

《敏捷估计与规划》一书为对敏捷项目进行估计与规划提供了权威实际的指导方针。在本书中,敏捷联盟的共同创始人Mike Cohn讨论了敏捷估计与规划的思想,并使用现实的例子与案例分析向您详细地展示了如何完成工作。本书清晰地阐述了有关的概念,并引导读者逐步认识到下列一些问题的答案:我们要构建什么?它的规模有多大?需要在什么时候完成?到那个时候我们到底能完成多少?您首先会认识到优秀的计划由哪些东西组成,接着......一起来看看 《敏捷估计与规划》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试