Month of December, 2008

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!