(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...
(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...
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...
These two books, long ago separately pre-ordered, arrived from different places on the same day:

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!