Hacker News new | past | comments | ask | show | jobs | submit login

I find that Haskell shines at a specific kind of hard problem, namely those involving significant math. It's particularly good for problems involving abstract algebra. Why?

1) The Haskell community tends to rely heavily on math—it's part of the culture. Part of this comes from Haskell's functional nature, which favors mathematical approaches, and part of it comes from a community tradition of using more math to work around the limits of functional programming.

2) A typical Haskell library is usually an algebra defined over an abstract data type. Haskell has excellent abstract data types, and good pattern matching, which makes this a natural way to work.

3) The QuickCheck library generates random input data for functional programs, and makes sure that certain invariants always hold. For example, you can use QuickCheck to verify that (reverse (reverse xs)) is equal to xs.

4) If your problem domain has a certain mathematical structure (specifically, a topos or a closed Cartesian category), then there are some really slick ways to map it onto a Haskell DSL. See my notes at http://www.randomhacks.net/darcs/probability-monads/probabil... (PDF) for an example involving Bayesian filtering and particle systems.

5) Haskell's strong type system make it feasible to work at very high levels of abstraction without going completely insane. For ordinary CRUD apps, I actually prefer dynamically-typed languages, but when it comes to scary math, a good type system makes life a lot easier.

6) Because Haskell is so steeped in math, it tends to force my brain into "math mode" well before I reach the mathematical heart of a problem.

So I'm not convinced that Haskell is the ideal language for small DSLs. (Ruby shines, here, for almost exactly opposite reasons.) But when there's enough math involved, Haskell is absolutely a wonderful language.




Have you tried F#? If so, could you say the same things about F# as well?

Also could you explain the last point "Because Haskell is so steeped in math"?


The linked notes on particle filtering are very interesting, thanks for sharing. You've just piqued my interest in Haskell.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: