Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I implement HATEOAS in Haskell?

I have some old code which exposes services on a web API which works basically on HTTP verbs. I'd like to move this project to use hypermedia controls (HATEOAS). I'm wondering if there are any libraries already that support embedding links in resource representation for sub resources in accordance with HAL or JSON-LD specs. I've googled around but I couldn't find anything. It would be good to know if one of the mature projects like Yesod, Snap or Happstack are planning on supporting this feature?

Edit: To clarify, I'm interested in level 3 of the REST Maturity Model

like image 259
opensourcegeek Avatar asked Apr 26 '14 08:04

opensourcegeek


2 Answers

Have you seen HAL before? It's a specification format for hypermedia objects. The github wiki for the spec has a list of libraries but I don't see any haskell libraries on there.
However, a quick google turns up https://github.com/talios/haskell-hal. Doesn't look super popular, but maybe after reading about HAL you'll contribute, fork it, or launch your own!

like image 97
kag0 Avatar answered Nov 13 '22 09:11

kag0


The json-api package purports to offer some support for HATEOS. This is the output of this example code demonstrating how you might generate a HATEOS/HAL style response.

like image 28
John Avatar answered Nov 13 '22 08:11

John