[Haskell-cafe] Typesafe API calls

Fabian Bergmark fabian.bergmark at gmail.com
Fri Dec 12 07:01:06 UTC 2014

I just released a library on hackage
(https://hackage.haskell.org/package/apis-0.0.0). The goal of the
library is to provide typesafe API calls to a large amount of existing
APIs. By typesafe I mean that, for each API the library provides two
types, Input and Output, and a function :: Input -> IO Output.
Internally the library knows how to serialize Input to make an HTTP
request and how to deserialize the response into Output.

Whats cool about this library is that it uses Template Haskell to
generate the API interfaces. A combination of Open Data Tables, an
internal YQL engine and JSON Schemas, all written in Haskell makes
this possible.

Right now only two APIs are included (Swedish weather data and Swedish
public announcement), but more APIs are soon to follow.

I have also implemented FFI exports of all types and functions so
that, in combination with SWIG, this library can be used in almost any
language. So far I have tried Java and Python with success.

If anyone would like to try it and respond with feedback it would be
greatly appreciated! If you want any specific API supported, I can try
to import that right away

Fabian Bergmark

More information about the Haskell-Cafe mailing list