BT

InfoQ Homepage News rest: Open Source REST Framework For Haskell

rest: Open Source REST Framework For Haskell

Bookmarks

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-gen: Automatic generation of documentation and Haskell, JavaScript and Ruby clients from a rest API
  • 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.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.