# Haskell at FINN.no

DevFeed: [Haskell at FINN.no](<https://devfeed.tech/articles/haskell-at-finn-no-32027.md>)

Original publisher: [Read original article](<https://tech.finn.no2018/10/18/haskell-at-finn-no/>)

Author: Sjur Millidahl

Published: 2018-10-18T09:00:00Z

Content type: opinion

Language: en

Sources: [Finn.no](<https://devfeed.tech/sources/finn-no.md>)

Topics: [Haskell](<https://devfeed.tech/topics/haskell.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [API](<https://devfeed.tech/topics/api.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Docker](<https://devfeed.tech/topics/docker.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [backend](<https://devfeed.tech/tags/backend.md>), [blog-post](<https://devfeed.tech/tags/blog-post.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [docker](<https://devfeed.tech/tags/docker.md>), [functional](<https://devfeed.tech/tags/functional.md>), [haskell](<https://devfeed.tech/tags/haskell.md>)

## AI overview

This blog post describes FINN.no's redesign of the backend API for its favorites feature using Haskell. It discusses Haskell's type system, Servant, Aeson, Hasql, Stack, compiler-assisted API refactoring, testing, and Docker deployment. The article also notes the need to train developers in Haskell.

## Source excerpt

Favorites FINN has this feature where users can mark classified ads as a favorite, making it easy to come back to certain ads later. The feature has been around quite a while, and the systems involved, both frontend and backend were becoming quite hard to maintain. So the AdView-team set out to redesign the whole stack. This blog post will focus on the backend API, which is written in Haskell. Haskell Haskell is a purely functional programming language, with a powerful type system. The ability to express intent using types brings correctness, and the composition of a large program as small, independent building blocks makes it easy to reason about the code. A large ecosystem of production grade libraries are available from Hackage. We make use of Servant (API), Aeson (JSON), Hasql (postgres) and many more. Servant is a type-level API, meaning the "sum" of all our endpoints become a distinct type. This, in turn, means that refactoring our API gives us heavy compiler assistance. More than once during development, we had the need to do major changes in the endpoints (verbs, paths, request body, responses) and found that once every compilation error was resolved, the new API was working correctly. To manage external packages, build and test code, we use Stack, because of its familiarity to maven, gradle and sbt-users. stack build will compile the project, stack test run all the tests. Stack pulls down Glasgow Haskell Compiler ("GHC") along with required libraries. It also supports building and running of the final program in Docker. Now Docker is important, because of the cloud infrastructure in FINN; any technology running in Docker can be used as a new Micro Service. Experiences So what are the downsides to using Haskell? Well - there is really only one. We have to have a certain amount of developers, at least in our team, know Haskell. We meet this challenge in three ways. Firstly by doing a Haskell course internally at FINN. 21 of our developers have signed up for a