Posts with keyword: haskell


jQuery, Monads, and Functional Programming

I tweeted this over the weekend, but it deserves a bigger mention than that. Patrick Thomson has written a wonderful description of why jQuery is a monad including a discussion of cautious computation and state transformations. No need to know monads or jQuery (although an interest in one will help you appreciate the other). As Patrick explains nicely, jQuery is monadic in that is meets all three requirements of a monad. A monad is a concept from category theory. A type is a monad if it meets three requirements Monads wrap themselves around other data types
Continue reading {jQuery, Monads, and Functional Programming}


Transactional Memory

We all know that Intel and AMD have punted. They can't keep building larger, faster chips for a variety of technical and economic reasons, so they have started placing multiple cores on a single chip. This, in theory, maintains the overall processing power and is easier to build. There's just one catch: it's much harder to program because to make use of that power, you have to program concurrently. Don't get me wrong. I'm not complaining. Microprocessor engineers have saved programmers from the hassles of concurrency for years. That's as it should be: get it right once at the
Continue reading {Transactional Memory}


Haskell vs. Java Smackdown

Defmacro.org has a small example of Haskell's expressive power and the same code written in Java. Both take five lines of code to "[go] through a parse tree of Haskell source code, locates every reference to an identifier that ends with 'Widget', puts it on a list, and removes duplicates so every identifier is represented in the list only once." Impressive. I believe that Haskell code is a bit more general and defmacro.org argues that it's more maintainable. You be the judge.
Continue reading {Haskell vs. Java Smackdown}


And Now...Scheme in Haskell

AS a followup to my post last week about building a Lisp interpreter in Haskell, here's a similar, albeit more in-depth, tutorial that shows how to implement a good-sized subset of R5RS Scheme in Haskell.
Continue reading {And Now...Scheme in Haskell}


A Lisp Interpreter in Haskell

Defmacro.org has an excellent little article on using Haskell to build a working Lisp interpreter--at least a good start at one. I do something similar with my 330 class using Gofer (an outdated dialect related to Haskell). I mostly use Gofer to show them how type inference works, but since they're studying interpreters, they might as well see an inerpreter in Gofer while we're at it. It's been too long since I've known monads well enough to decipher what he does at the end. I'm going to have to go back and review and then look at his article
Continue reading {A Lisp Interpreter in Haskell}