[ANN] servant 0.2 - trying to rethink webservices and APIs

Hello -cafe, These past few weeks, with Sönke Hahn and Julian Arni, we've been working on a complete rewrite of servant, a library whose aim is to assist as much as possible in writing webservices. We came up with a (type-level) "API combinator" based design, that lets us declare webservice APIs, implement handlers that serve those APIs, derive client functions in Haskell and Javascript to query those endpoints and generate documentation. This is all very composable, you can write your own combinators or write your own interpretation of an API's type, or just use the "standard" ones already provided by the core library. Here's an announcement post with an example: http://alpmestan.com/posts/2014-12-09-rethinking-webservices-apis-haskell.ht... Getting started guide: http://haskell-servant.github.io/getting-started/ The reddit discussion (in case you prefer reddit to here for such discussions): http://www.reddit.com/r/haskell/comments/2orb8t/rethinking_webservice_and_ap... All 4 libraries are installable with a simple 'cabal install', have a decent amount of documentation and accompanying examples. We would be glad to hear any kind of feedback or ideas -- we're already deploying servant webservices in our respective companies so it suits our use cases, but we would gladly discuss new combinators and what not. -- Alp Mestanogullari

Hello, Interesting, thank you! Can your library handle optional parameters? I guess, not right now but can be done, right? At first glance I thought the :> operator had something to do with subtyping.How about defining the operators somehow like this: type UserAPI = "users" > "search" > QueryParam "q" Text <,> QueryParam "n" Word64 ::: Get [User] In addition to more visual resemblance to http, you could probably enforce more type safety this way, too. -- Kind regards, Wojtek Narczynski

Hello,
Querystring parameters are optional. The corresponding handler argument is
automatically a Maybe, because one can reach this endpoint while not
specifying a value for that param.
I understand the operator naming scheme can be a bit odd when you're not
used to it, we'll see what suits people the most after we get more feedback
on that :)
Le 10 déc. 2014 00:18, "Wojtek Narczyński"
Hello,
Interesting, thank you!
Can your library handle optional parameters? I guess, not right now but can be done, right?
At first glance I thought the :> operator had something to do with subtyping.How about defining the operators somehow like this:
type UserAPI = "users" > "search" > QueryParam "q" Text <,> QueryParam "n" Word64 ::: Get [User]
In addition to more visual resemblance to http, you could probably enforce more type safety this way, too.
-- Kind regards, Wojtek Narczynski _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Alp Mestanogullari
-
Wojtek Narczyński