Mr. 23

Quack!
Like this?

1 note

Functional Programming Languages should be Eager

I think this is largely the reason Haskell is hardly used and other languages like OCaml and Lisp are more widespread.

Functional programming languages aren’t very widespread, but of them, Haskell is hardly used outside of academia at all. I was thinking today why it’s not and why Lisp and ML based languages are (to some degree). Last night I was reading about a couple of Financial firms that use OCaml (an ML variant) and I realized why they might prefer that over Haskell, Haskell has lazy evaluation whereas OCaml has eager evaluation.

I know Haskell to some degree and just starting to learn F# (Microsoft’s version of OCaml, largely the same syntax plus benefits of .NET). Haskell is really eloquent but some things are just hard to do with it. Haskell is good at doing math stuff but I wouldn’t consider making a bot or webservice with it. I think the reason it becomes hard is because of it’s laziness.

Laziness is Haskell’s two sided sword, it’s a very powerful language feature (i.e. you can represent infinite sequences and lists without bounds) but it also makes certain thingsĀ convolutedĀ and hard to do. ML based languages seem mostly “pure” (purely functional) but they lose their “purity” to some extent to make things easier. I really need more experience to make a fair opinion, but I don’t think making infinite sequences happens too frequently (except maybe in math software).

Filed under CompSci

  1. mr23 posted this