haskell

"Pentecostal movements" / 2009-01-05

This is a funny and very insightful comment about programming practice from Kay Schluehr:

Generalizing Functor / 2008-12-19

Tags:

(From a couple of conversations in #haskell...) The other day, Peaker was trying to characterize a relationship between Arrow and Functor. I'm not sure I understood his intuition, but there's one relationship that seemed obvious to me...

Pointless fun / 2008-12-03

Tags:

At the end of my last post, I posed a question: can we write combinators that allow us to write something like this:

argument length . (result.argument) length $ compare

more like this:

compare <$> length <*> length

(Of course, we aren't really looking for an instance of Applicative, so the actual combinators will be different. But you see the idea...)

After a bit of thought, I've found that we can solve this pretty easily. I suspected that the solution would involve type classes, but it doesn't. If we compromise (or generalize) and add a transformer for the result type as well, we can define ($.) and (~>) so that we can write:

compare $. length ~> length ~> id

Implementation follows...

A clearer point-free style / 2008-12-02

Tags:

Conal Elliott has been explaining (1, 2) what he calls semantic editor combinators, which I've also seen referred to as (fmap.fmap) style. It's great stuff. Simple, clear, and a big payoff. For a long time, I've wanted a better (read: clearer) way of transforming arguments of curried functions.

Coincidence? / 2008-12-01

Tags: ,

These two books, long ago separately pre-ordered, arrived from different places on the same day:
today's mail
One of the things keeping me busy lately has been a Haskell reading group, which has mostly amounted to me teaching some people Haskell, using this book as the main text. We've been using the web preprint, and it's exciting to see the real thing!

Functional programming to the rescue / 2008-05-09

Three days of JavaOne was enough to completely sour me on the entire idea of programming. I'm not really sure what did it. But then I made the right decision and went to the BayFP meeting. I left feeling quite rejuvenated, my faith in humanity and love of programming fully restored.

Hitting the wall / 2008-03-10

In my last post, I translated the first part of Data types a la carte into Scala. I decided to push ahead into the next section, just for fun. The summary is: Scala's implicits are a very poor man's type classes, at least using the obvious encoding, and I am as always humbled by the cleverness of GHC.

Scala vs Skalleh / 2008-03-07

I apologize for what you're about to see...

As a little experiment, I decided to translate part of this pearl from Haskell to Scala. By this I mean literal translation, as opposed to an idiomatic implementation in Scala. Of course, this goes deeply against the grain of the Scala language. On the other hand, as I wrote here:

It certainly cuts across the grain of current practice, and the grain of the libraries. But I think it takes a long time to discern the grain of a language. And I think it takes a lot of pushing and prodding, which is why I think this kind of experimentation is so important.

For now, it's a reasonable default to stick to a style that reflects the origins of the language (mostly Java-style OO with some functional goodies and richer types). I definitely think we should be open to the possibility that Scala style will diverge more radically from this tradition.

At this point, I'd probably replace the word "important" with "fun and maybe sort of worthwhile." Anyway, let's get started...