Servant (web framework)

Last updated
Servant
Original author(s) Alp Mestanogullari, Sönke Hahn, Julian Arni
Initial release2014;10 years ago (2014)
Written in Haskell
Operating system Cross-platform
Available inEnglish
Type Web framework
License BSD 3-clause license [1]
Website www.servant.dev

Servant is a web framework based on the programming language Haskell, with an emphasis on data type safety. [2] [3] [4] It is free and open-source software released under a BSD 3-clause license.

Contents

Overview

Servant provides a type-level domain-specific language (DSL) to describe World Wide Web application programming interfaces (Web APIs); various interpretations of such descriptions are possible: as a server, which dispatches requests to handlers; as documentation and schema specifications for the API; and as client libraries in various languages. [5]

The type-level approach by Servant solves the expression problem by allowing the extensibility along the dimensions of both data and behavior. [5] New combinators or terms in the DSL can be modularly introduced, as can new interpretations of them, as entirely separate packages. As of 2023, well over 100 packages related to Servant have been published in the Haskell package repository. [6]

Usage

It is used in production by companies such as GitHub, [7] NoRedInk, [8] Klarna, [9] Input Output Global Inc. (in the Cardano project), [10] and Wire. [11]

See also

Related Research Articles

<span class="mw-page-title-main">Java (programming language)</span> Object-oriented programming language

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities that are typically not available in traditional compiled languages.

In computing, serialization is the process of translating a data structure or object state into a format that can be stored or transmitted and reconstructed later. When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward. Serialization of objects does not include any of their associated methods with which they were previously linked.

Programming languages can be grouped by the number and types of paradigms supported.

HaXml is a collection of utilities for parsing, filtering, transforming, and generating Extensible Markup Language (XML) documents using the programming language Haskell.

In computing, an effect system is a formal system that describes the computational effects of computer programs, such as side effects. An effect system can be used to provide a compile-time check of the possible effects of the program.

Quantum programming is the process of designing or assembling sequences of instructions, called quantum circuits, using gates, switches, and operators to manipulate a quantum system for a desired outcome or results of a given experiment. Quantum circuit algorithms can be implemented on integrated circuits, conducted with instrumentation, or written in a programming language for use with a quantum computer or a quantum processor.

<span class="mw-page-title-main">Philip Wadler</span> American computer scientist

Philip Lee Wadler is a UK-based American computer scientist known for his contributions to programming language design and type theory. He is holds the position of Personal Chair of theoretical computer science at the Laboratory for Foundations of Computer Science at the School of Informatics, University of Edinburgh. He has contributed to the theory behind functional programming and the use of monads; and the designs of the purely functional language Haskell and the XQuery declarative query language. In 1984, he created the Orwell language. Wadler was involved in adding generic types to Java 5.0. He is also author of "Theorems for free!", a paper that gave rise to much research on functional language optimization.

Haskell is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell has pioneered a number of programming language features such as type classes, which enable type-safe operator overloading, and monadic input/output (IO). It is named after logician Haskell Curry. Haskell's main implementation is the Glasgow Haskell Compiler (GHC).

<span class="mw-page-title-main">API</span> Software interface between computer programs

An application programming interface (API) is a way for two or more computer programs or components to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build or use such a connection or interface is called an API specification. A computer system that meets this standard is said to implement or expose an API. The term API may refer either to the specification or to the implementation. Whereas a system's user interface dictates how its end-users interact with the system in question, its API dictates how to write code that takes advantage of that system's capabilities.

Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. It can be used to develop web and mobile apps as well as server and desktop applications.

<span class="mw-page-title-main">GraalVM</span> Virtual machine software

GraalVM is a Java Development Kit (JDK) written in Java. The open-source distribution of GraalVM is based on OpenJDK, and the enterprise distribution is based on Oracle JDK. As well as just-in-time (JIT) compilation, GraalVM can compile a Java application ahead of time. This allows for faster initialization, greater runtime performance, and decreased resource consumption, but the resulting executable can only run on the platform it was compiled for.

<span class="mw-page-title-main">WebAssembly</span> Cross-platform assembly language and bytecode designed for execution in web browsers

WebAssembly (Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environment.

<span class="mw-page-title-main">GraphQL</span> Data query language developed by Facebook

GraphQL is a data query and manipulation language for APIs, that allows a client to specify what data it needs. A GraphQL server can fetch data from separate sources for a single client query and present the results in a unified graph, so it is not tied to any specific database or storage engine.

<span class="mw-page-title-main">SYCL</span> Higher-level programming standard for heterogeneous computing

SYCL is a higher-level programming model to improve programming productivity on various hardware accelerators. It is a single-source embedded domain-specific language (eDSL) based on pure C++17. It is a standard developed by Khronos Group, announced in March 2014.

<span class="mw-page-title-main">PureScript</span> Strongly-typed language that compiles to JavaScript

PureScript is a strongly-typed, purely-functional programming language that transpiles to JavaScript, C++11, Erlang, and Go. It can be used to develop web applications, server side apps, and also desktop applications with use of Electron or via C++11 and Go compilers with suitable libraries. Its syntax is mostly comparable to that of Haskell. In addition, it introduces row polymorphism and extensible records. Also, contrary to Haskell, the PureScript language is defined as having a strict evaluation strategy, although there are non-conforming back ends which implement a lazy evaluation strategy.

<span class="mw-page-title-main">Deno (software)</span> Secure JavaScript and TypeScript runtime

Deno is a runtime for JavaScript, TypeScript, and WebAssembly that is based on the V8 JavaScript engine and the Rust programming language. Deno was co-created by Ryan Dahl, who also created Node.js.

Multitier programming is a programming paradigm for distributed software, which typically follows a multitier architecture, physically separating different functional aspects of the software into different tiers. Multitier programming allows functionalities that span multiple of such tiers to be developed in a single compilation unit using a single programming language. Without multitier programming, tiers are developed using different languages, e.g., JavaScript for the Web client, PHP for the Web server and SQL for the database. Multitier programming is often integrated into general-purpose languages by extending them with support for distribution.

FastAPI is a web framework for building HTTP-based service APIs in Python 3.8+. It uses Pydantic and type hints to validate, serialize and deserialize data. It also automatically generates OpenAPI documentation for APIs built with it. It was first released in 2018.

References

  1. "Servant license". GitHub. Retrieved 10 February 2023.
  2. Bragilevsky, Vitaly (2021). Haskell in Depth. Manning. ISBN   9781617295409.
  3. Putrady, Ecky (2018). Practical Web Development with Haskell: Master the Essential Skills to Build Fast and Scalable Web Applications. Apress. ISBN   978-1484237380.
  4. Mazumder, Mark; Braje, Timothy (2016). "Safe Client/Server Web Development with Haskell". 2016 IEEE Cybersecurity Development (SecDev). p. 150. doi:10.1109/SecDev.2016.040. ISBN   978-1-5090-5589-0. S2CID   1953852.
  5. 1 2 Mestanogullari, Alp; Hahn, Sönke; Arni, Julian; Löh, Andreas (2015). "Type-level web APIs with Servant: An exercise in domain-specific generic programming". Proceedings of the 11th ACM SIGPLAN Workshop on Generic Programming. pp. 1–12. doi:10.1145/2808098.2808099. ISBN   9781450338103. S2CID   14512955.{{cite book}}: CS1 maint: date and year (link)
  6. "Browse and search packages". Haskell.org: Hackage.
  7. Thomson, Patrick; Rix, Rob; Wu, Nicolas; Schrijvers, Tom (2022). "Fusing Industry and Academia at GitHub (Experience Report)". Proceedings of the ACM on Programming Languages. 6: 496–511. arXiv: 2206.09206 . doi:10.1145/3547639. S2CID   249889460.
  8. "Type-Safe MySQL Queries via Postgres". NoRedInk Blog. 5 November 2019. Retrieved 16 February 2023.
  9. Mulder, Felix. "Haskell in Production: Services at Klarna written in Haskell" . Retrieved 16 February 2023.
  10. "Cardano Wallet Design" . Retrieved 16 February 2023.
  11. "Servant". Wire Documentation. Retrieved 16 February 2023.