Posted in haskell on September 25th, 2007 9 Comments »
Tim Bray has recently been writing about a simple log file processing
task, giving his efforts the (decidedly peculiar) name of Wide
Finder.
The task at hand is to count popular links in an Apache log file.
Here’s my two minutes’ worth of hat in the ring, in Haskell.
> main = do
> args <- getArgs
> [...]
Posted in haskell, open source on September 5th, 2007 1 Comment »
I’ve spent a few spare hours here and there working on a pure Haskell interface to MySQL recently. On the principle that perhaps someone else might want to join in the fun, I’ve published a darcs repository already (see the link above for more details):
darcs get http://darcs.serpentine.com/mysql
There are a few reasons I’m doing this. One [...]
Posted in haskell on August 27th, 2007 No Comments »
Some months ago, I wrote a Python implementation of Daniel Lemire’s Weighted Slope One collaborative filtering algorithm.
Steve Jenson sent me a pointer to his Scala implementation last week, but his code is a straight port of the Python version, not using any of Scala’s tasty functional crunchiness. In an idle period the other evening, I [...]
Posted in haskell on August 23rd, 2007 2 Comments »
A few days ago, I wrote a Haskell library for building and working with suffix trees. It builds a suffix tree lazily, so even though its performance is O(n log n) on large input strings, it often has linear performance for many applications.
The implementation is simple and easy to read; the API is well-documented and [...]
Posted in haskell on July 29th, 2007 5 Comments »
Here’s a great quote from Yaron Minsky about the use of types in functional programs.
[...] most of the advantage of types in a language like ML comes from completely vanilla uses of the type system. One of our programming maxims at Jane Street is to “make illegal states unrepresentable”. Algebraic datatypes, parametric polymorphism and abstraction [...]
Posted in haskell, open source on May 23rd, 2007 1 Comment »
I’ve been sitting on this for a while, so I’m very excited to announce
that Don Stewart, John Goerzen and I are collaborating on an upcoming
book for O’Reilly, the working title of which is “Real-World Haskell”.
Better yet, O’Reilly has agreed to publish the title under a Creative
Commons license!
You can find more details, and follow our progress, [...]
Posted in haskell, linux on May 14th, 2007 No Comments »
With Jens Petersen’s blessing, I’ve packaged GHC 6.6.1 for Fedora
Extras. If you use FC6, it’s available via yum as of a few days
ago. It will be a part of Fedora 7 as soon as that comes out, too.
The upgrade to 6.6.1 necessitated a bump of the release number of
the Fedora Gtk2Hs package, too. [...]
Posted in haskell on May 14th, 2007 No Comments »
A few weeks ago, I spent a little time porting Peter Norvig’s Python
code from his article How to Write a Spelling
Corrector to Haskell. It’s a
concise vehicle for a few Haskelly topics that don’t get much airing
in front of a general audience: what idiomatic Haskell looks like, and
the dreaded space leak.
Bear in mind as you [...]
I just released version 0.1 of
FileManip,
a Haskell library I put together to make it easier to futz about
with files in the filesystem.
There are a few different components to the package.
The
Find
module lets you search the filesystem for files, after the manner of
the Unix find program. It provides a nice embedded language for
building filters and controlling [...]
Posted in haskell on April 23rd, 2007 4 Comments »
I don’t intend for this blog to become a dumping ground for code
snippets, but sometimes the temptation is too strong. Here’s a simple but
fast function for computing a factorial, using the binary splitting
algorithm from this
page.
factorial :: Integral a => a -> a
factorial n = split n 0
where split a b = let d = [...]