
Facebook open sources Haxl - ainsej
https://code.facebook.com/projects/854888367872565/haxl/
======
AaronFriel
This is a fascinating project. Haxl is the brainchild of former Glasgow
Haskell Compiler lead* Simon Marlow.

The tl;dr of Haxl: what if you could describe accessing a data store (a la
SQL) and have the compiler and library work together to "figure out" the most
efficient way to perform queries, including performing multiple queries in
parallel? That's what Haxl does, it allows you to specify the "shape" of your
query, the type checker verifies its correctness, and the library executes it
in parallel for you, without the developer having to know about synchronizing
access or anything.

Here's a link to their paper (PDF):
[http://www.haskell.org/wikiupload/c/cf/The_Haxl_Project_at_F...](http://www.haskell.org/wikiupload/c/cf/The_Haxl_Project_at_Facebook.pdf)

* - I am not sure if he's still committing, or if he's only doing application development. His accomplishments in Haskell land though, are many.

Edited: I removed my comment about GitHub issues, seems it's a known problem.
:)

~~~
simonmar
He is still committing, but not quite so often :)

~~~
Evgeny
Is it a cultural reference? Found it in bestcomments, so looks like many
people do get it, but I don't. Genuinely interested having English as a second
language.

------
simonmar
Here's our paper about the ideas behind Haxl:
[http://community.haskell.org/~simonmar/papers/haxl-
icfp14.pd...](http://community.haskell.org/~simonmar/papers/haxl-icfp14.pdf)

~~~
seanmcdirmid
Somehow I think this should have been upvoted to the top.

~~~
untothebreach
Simon Marlow and Sean McDirmid in the same thread? Be still my heart!

------
lbrandy
Hi. I'm one of the engineers who has worked on this so if anyone has any
specific questions I can help answer and/or get someone to answer.

As said by @nbm, we also have a blog post up:
[https://code.facebook.com/posts/302060973291128/open-
sourcin...](https://code.facebook.com/posts/302060973291128/open-sourcing-
haxl-a-library-for-haskell/).

~~~
evmar
Have you replaced all use of FXL with Haxl? Or are both languages supported?
In the latter case, what is the relative proportion of each in the live
codebase?

(I appreciate that migrating code that already works to a new language often
just introduces bugs for no gain, so please don't take my questions as trying
to dig up dirt or anything. I'm genuinely just curious.)

~~~
evincarofautumn
We are still in the process of migrating from FXL to Haxl, and there is too
much FXL code to translate manually, so at the moment we are treating FXL as
the source of truth, compiling the FXL codebase to Haskell, and running both
concurrently to verify correctness.

------
nbm
The release blog post is here -
[https://code.facebook.com/posts/302060973291128/open-
sourcin...](https://code.facebook.com/posts/302060973291128/open-sourcing-
haxl-a-library-for-haskell/)

It contains a lot more information about the problem it was originally created
to solve, and potential other use cases.

------
JonCoens
I'm an engineer on the Haxl project and am really excited to launch this
today. Ask me anything!

~~~
nusbit
Is there any resources about why Facebook uses haskell? What's your
experience?

~~~
JonCoens
Our blog post goes into some of this:
[https://code.facebook.com/posts/302060973291128/open-
sourcin...](https://code.facebook.com/posts/302060973291128/open-sourcing-
haxl-a-library-for-haskell/)

Interpreted code was no longer cutting it for perf reasons, and any time you
create your own language you end up reinventing the entire tool chain
(debuggers, profilers, etc.). Haskell provides so much functionality in the
language itself and has mature solutions to the other issues plaguing us in
FXL, so it was a natural choice.

------
fiatjaf
[http://hackage.haskell.org/package/haxl](http://hackage.haskell.org/package/haxl)

Why do Haskell libraries on Hackage doesn't come even with a single example,
getting started, how to use, quick start, nothing, really, just function
declarations? This scares Haskell newbies.

~~~
m0nastic
The "documentation" on Hackage is almost universally just the haddock-
generated files (which is why it's mostly just function declarations and type
signatures).

Most libraries list a "Home Page" that more often than not includes more
useful documentation (Haxl's, for example, has the things you've mentioned).

I concur, that most of the time, the documentation on Hackage isn't really
sufficient, but I've found that for the most part I just use it to find the
homepage, and then go there to read the actual documentation.

I agree that it would be nice if everything was all in one place.

~~~
dllthomas
_" I agree that it would be nice if everything was all in one place."_

I actually find "distilled reference with links to source" a fantastically
valuable view. I've no objection to providing some sort of combined view, but
let's not lose what we have in a quest for consolidation. I've no idea if
that's what you meant or not, and don't mean to put words in your mouth of
course, just expressing a concern.

~~~
m0nastic
I agree it's hard to be all things to all people.

I think fundamentally, Hackage is meant to be a centralized package
repository. If you look at other similar projects, there seems to be no real
consensus as to whether that should just be a launching-off point to the
actual project page, or more inclusive.

When I originally wrote this, I was going to say "It's akin to CPAN", but then
to make sure I wasn't misremembering, I looked at a bunch of CPAN packages and
saw that they were all actually fully-documented (with examples and whatnot).

I think the advantage to having consolidation is that you can then at least
try to enforce documentation standards (whether you should, is arguable).
What's super frustrating is going to a Hackage page, finding the link to the
project home page (frequently on GitHub), going to the GitHub page and then
just seeing a barren directory listing of files.

I feel slightly uncomfortable making statements about how Hackage should be
set up however, as it's like going to a soup kitchen and then complaining
about the specific soup they've decided to give you. "Oh, you mean this
community resource we've set up which allows anyone to contribute a package
and have it globally available doesn't provide exactly the functionality you'd
like? Please tell me more about how the community can respond to your whims."

Also, for what it's worth, all the Haskell libraries that I make frequent use
of tend to have very good documentation (you could argue that's HOW they end
up becoming the ones I make frequent use of).

------
edofic
Slides from Marlow from 9 months ago about Haxl and it's workings
[https://github.com/meiersi/HaskellerZ/blob/master/meetups/20...](https://github.com/meiersi/HaskellerZ/blob/master/meetups/20130829-FPAfternoon_The_Haxl_Project_at_Facebook/The%20Haxl%20Project%20at%20Facebook.pdf?raw=true)

------
EGreg
How do you guys batch requests in PHP? You don't, right? So this is an
intermediate layer basically, and it sends requests every few millisecods and
waits to batch things in between?

~~~
nbm
The systems described here isn't directly involved with any PHP code.

Like all Facebook services, they are communicated with over the Thrift RPC
system, and may have PHP (or any other language) clients, and may talk to
other services using Thrift (or occasionally other protocols), some of which
may use PHP.

If you're asking a general question about batching requests in PHP,
[http://docs.hhvm.com/manual/en/hack.async.php](http://docs.hhvm.com/manual/en/hack.async.php)
may be informative.

~~~
EGreg
Cool so Hack supports async while php doesn't.

------
radnam
Cool ! Are there any alternatives out there, especially to deal with fault
tolerance especially when if we want to establish connection with 100's of
varied databases?

------
polskibus
How does the functionality of Haxl differ from a mature ORM system? I'm
thinking about .NET Entity Framework + LINQ in particular since it not only
does the mapping but also assists in query generation, scheduling.

------
mkesper
It would be cool if you could transform those tables into HTML tables. They
would look prettier (not nice JPG noise) and would also be more accessible.

------
skyahead
are there similar things for iOS?

------
EGreg
[http://platform.qbix.com/guide/patterns](http://platform.qbix.com/guide/patterns)
;-)

~~~
ixmatus
You obviously don't understand what Haxl is for.

~~~
EGreg
Why is that obvious to you? Do you care to explain your cryptic comment?

~~~
ixmatus
Well, that project, Q just doesn't even share the same thesis of Haxl. At all.
Two completely different projects, Q couldn't be used for what Haxl is
intended.

If you had posted the link asking for a comparison, that would've been
different, but your ignorance seemed obvious to me because of the haughty wink
at the end of your posted link implying we were being let in on some kind of
secret.

