rest: Open Source REST Framework For Haskell
Silk has recently open-sourced a REST framework for Haskell, called "rest". It provides a DSL for defining REST services which can then be run in popular web frameworks such as happstack. This comes with features such as type-safe URLs, abstraction of format-type support, and a clean separation of API specification and business logic.
rest comprises of 3 main components -
- rest-core: A DSL for defining versioned REST resources
- rest-snap, rest-happstack, rest-wai: Drivers for runnnig resources using the corresponding web server
There are several other packages such as rest-client, rest-types, json-schema, generic-aeson and so on, which are used by and can be used along with rest. You can learn more about these in detail in the announcement.
The popular Haskell web frameworks already provide support for features such as type-safe urls, routing, templating etc. The main advantage of using "rest" is that it allows separation of business logic from the API definition concerns such as routing, parsing/serializing to input/output formats and request-types supported for a particular resource. To do this, it provides various "smart" constructors that you can use to wrap your strongly-typed functions.
Have a look at this tutorial, to learn more and get started with rest.
Sarah Howe Jul 06, 2015