Category Archives: Haskell

The One Function per Typeclass Rule

After about five years programming in Haskell, I think we need a rule:  Only put one function in a typeclass. Why?  Because inevitably someone comes along with a data type for which one or the other function of a typeclass … Continue reading

Posted in Haskell | 5 Comments

Memoized Dataflow Streams

In reactive programming we can choose between two models: “pull,” in which we run a computation each time output is required, and “push,” in which we run the computation each time input arrives. Which model we use depends on whether … Continue reading

Posted in Haskell | 1 Comment

A Brutal Introduction to Arrows

Imagine being killed by a bow and arrow. That would suck, an arrow killed you? They would never solve the crime. "Look at that dead guy. Let’s go that way." — Mitch Hedberg I seem to be one of the … Continue reading

Posted in Haskell | 2 Comments

Composable Blocking Transactions

Background: Software Transactional Memory (STM) is a foundation for atomic composable non-blocking transactions. An STM transaction consists of a set of variables and a monadic sequence of read/write operations on those variables. As the transaction progresses, a transaction table is … Continue reading

Posted in Haskell | Leave a comment

FactoryArrow

I’ve been playing around with an Arrow concept, which to my knowledge is original. I’ve decided to call this a FactoryArrow: newtype FactoryArrow m n a b = FactoryArrow { runFactory :: m (Kleisli n a b) } Where m … Continue reading

Posted in Haskell | 2 Comments

Vec is Good

Last night I checked out Scott E. Dillard’s Vec library. It’s a good, fast, pure implementation of the basic matrix operations applicable to 3D graphics. Switching to Vec has shaved off quite a bit of time from one of my … Continue reading

Posted in Haskell | 1 Comment

Trends in Profiling Haskell

I spent some time yesterday profiling roguestar. I do this every few months just to see where things stand, and there are always two culprits at the top of roguestar-gl.prof, every single time: * typeclass dictionary lookups in inner loops … Continue reading

Posted in Haskell | 5 Comments