Escolar Documentos
Profissional Documentos
Cultura Documentos
Bryan O'Sullivan
mailrank.com
In the beginning
I started with Haskell as an undergraduate in 1993
Took a ten-year "time to earn a paycheque" break
Worked lots in Java, C++, Python, C ... you name it
Linux kernel hacking, supercomputers, distributed systems, set-top boxes, all kinds of fun
projects
Relearning to walk
When I came back to Haskell, I once again found it daunting.
There were no appropriate books available.
Tutorial information was scattered all over.
Too much was buried in academic papers.
"Someone should really write a book," I said.
A bit of advice
When you hear someone say:
"There ought to be a ..."
"Someone should ..."
Ask a question:
"So when are you going to get going on that?"
Writing
I started planning a book in late 2006.
Pitched O'Reilly. They bit.
Found some collaborators.
Started work in May 2007, finished 15 months later.
Meanwhile
I'd worked in startups on and off for years
While I was working on Real World Haskell, I took a "startup sabbatical" at Linden Lab (makers
of Second Life)
Late last year, I was getting hungry to start something new
I started talking with some former colleagues
We found a compelling idea and seed funding, and got to work
MailRank
My company has been in business almost a year
We build an awesome product for helping people deal with their email
It's a hybrid app
The desktop piece is in C#
Cloud components are in Haskell
Scary decisions
Starting a company is a risky job.
You become acutely aware of this when you're making all the technical decisions.
That sense of acuity quadruples when it's an investor's money you're spending.
Why Haskell?
Criteria that worked well for me:
Do I know the language? Can I be productive fast enough?
Can I hire good people?
Do I know the terrain well enough to be able to predict and navigate problems?
Language knowledge
Not as big a roadblock as you might think.
On the one hand, I was a Haskell expert.
On the other, I never wrote a line of C# or used a modern IDE before December.
Both languages have worked out well, despite the difference in prior experience.
Hiring: signal
People who know Haskell well are of course thin on the ground.
The coding chops of Haskell experts are mind-blowing.
Even people who are interested in Haskell tend to have desirable characteristics, e.g. intellectual
curiosity, that can be predictive of good hires.
(The same tends to be true of Clojure and Scala.)
There are plenty of enthusiastic almost-Haskellers out there, so if you don't mind taking a risk,
the pool is big.
Hiring: noise
The more widespread a characteristic in a population, the less powerful it is as a filtering signal.
"Jane knows Haskell" does not imply "Jane is smart".
But uncommon characteristics hint that "Jane might have some other qualities that I
should take a closer look at".
Python used to be a good "knows language X" filtering characteristic, but no longer.
The presence or absence of C# on a resume is completely useless to a hiring manager at a
startup.
However ...
We're going to see a theme emerging here.
We wrote our own MySQL bindings:
github.com/mailrank/mysql-simple
I wasn't happy with either the API or the performance provided by the de facto standard Haskell
database interface.
Our bindings are really easy to use, and far faster than their predecessor.
Writing the bindings, and porting our app from Riak to MySQL, took about 2 days.
And data?
Happily, JSON has become the easiest and most widespread way for clients and servers to talk.
And (surprise!) we wrote our own JSON library:
github.com/mailrank/aeson
Again, easier to use and much faster than its predecessor.
Other bits
We wrote a fast, thread safe resource pooling library:
github.com/mailrank/pool
A library for handling app configuration:
github.com/mailrank/configurator
And plenty more libraries besides.
Building
We use the standard Haskell build tool, cabal.
Actually, we use a sandboxed version named cabal-dev, which gives more reproducible
builds.
Jenkins for continuous builds.
The units of deployment are tarballs containing executables, configuration, and other data.
Testing
Haskell has ridiculously good testing support.
The QuickCheck library - I cannot sing its praises highly enough.
Very different from traditional tests.
Generate random data, then tell me if all properties that I expect to be true of my
functions and data hold.
QuickCheck is shockingly more effective at finding bugs than unit tests.
Deployment
Deploying our code is a simple matter of redirecting a symlink, then bouncing the server.
Downtime during a deploy is a fraction of a second.
Types
After a language with decent type inference, C#'s local inference feels like "little Bobby's first
steps".
Some language features (smart getters and setters) encourage really shitty API design, and
Microsoft itself goes to town with them.
I'm looking at you, object property that sneakily gives back an entirely different COM handle
every time it's dereferenced!
Concurrency
After using STM (software transactional memory), concurrent programming in C# makes me
feel sad, old, and stupid.
And I'm only two of those things on good days.
By far our single hardest-to-find bug was a concurrency problem in a huge, complicated app
that we could only partly debug (tons of third party code).
The legacy hold-over of single-threaded COM apartments and other such cruft can be very
painful.
Next steps
We're continuing to write new code.
Going to be hiring soon!
Teaching "Functional Systems in Haskell" at Stanford, starting next week.
Thanks!