
. . .
What struck me was this bit of code:
assemblyLine w = (return w) >>= makeChopsticks >>= polishChopsticks >>= wrapChopsticks
Interestingly, this looks like Forth (!), where you put a value on the stack, and successive operations fiddle with the stack as a series of transformations. Not that I know Forth, you understand. Hmm, so Haskell can be a concatenative language if you want it to be.
Some time ago I had occasion to model a special-purpose machine in SML, and the potential users wanted a programmatic interface that looked like an assembly language for the machine. I modeled the instructions as curried functions with the machine state as the last parameter and return value, and defined a "reverse compose" function -- (f >> g) x === g (f x). This allowed me to write programs with op codes and parameters running down the page, just like real assembler (I tabbed over to place the ">>" so they kinda hung out in the comment area so as not to spoil the illusion). It was a quick 'n dirty hack that turned out to be pretty slick. -- Bill Wood bill.wood@acm.org