[Haskell-cafe] Typesafe API calls

Fabian Bergmark fabian.bergmark at gmail.com
Tue Dec 23 00:01:53 UTC 2014


I have uploaded a new version of the library

https://hackage.haskell.org/package/apis-0.0.1

I'have included 15 more APIs from Facebook and Dropbox. I have also
uploaded documentation to Hackage.

I have been working on creating an autotools installation script that
builds a makepkg package with the FFI bindings for Python and Java. I
have tried it on Arch and it seems to work. If you want to try it out,
check out the github repository.

Building on top of this, Im working on a library that uses Pipes to
create producers (triggers) and consumers (actions), allowing one to
create effects (recipes) of the kind, when I am tagged in a photo on
Facebook, notify me via email. This very much resembles IFTTT but with
static and typesafe compositions. Im experimenting with using my
javascript interpreter to allow for more dynamic compositions.


2014-12-18 21:59 GMT+01:00 Jonathan Paugh <jpaugh at gmx.us>:
> Hello Fabian,
>
> I have been dreaming of something like this for Haskell since I wrote a
> (non type-safe) python library to access any REST API generically[1].
> This comes from a different (and more ambitious) angle than I had imagined.
>
> I don't have time to test this just now, but I will keep it bookmarked.
> Thanks for sharing your hard work!
>
> Regards,
> Jonathan
>
> [1]: http://github.com/jpaugh/agithub (unmaintained, but maybe interesting)
>
> On 12/12/2014 07:01 AM, Fabian Bergmark wrote:> 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