[Haskell-cafe] Random obeservations from my playing with Haskell
rolf_wilms at hotmail.com
Sun Dec 5 18:19:00 EST 2004
[Newbie warning on] Here's a few random obeservations from my playing with
1. Switched to exploring Haskell from SML after finding out that it supports
polymorphism in contrast to SML and has nicer syntax. Good.
2. Frequently saw a "quick sort" implementation in Haskell as a proof for
its nice syntax. Realized that an implementation in Smalltalk would have
been as nice.
2. Tried to implement a "modular arithmetic" module. Soon realized that a
type parameterized over the modulus would be cool. Found out that it could
be done, is rather
tricky (to an extent that I don't really understand it) and requires
non-standard extensions to Haskell '98.
3. Considered Haskell as a replacement for an untyped DSL used in financial
services. Soon realized that generic programming (e.g. sum premium over all
covers) was not
possible and everything would have to be explicit. Bad. Recently discovered
"scrap your boilerplate". Sounds like the solution but again requires
4. Tried to implement the "game of nim", my version of "hello world", in
Haskell. My god, this even works out nicer than in Prolog! But: in order to
make it efficient a function
needs to be memoized. Tried to implement a generic function memoizer using
FiniteMap and Monads. Didn't get it right, might be me lacking intellect.
Recently found a
memoization modulue in Hugs, but no docs. There's a reference to the Haskell
'97 Report, but I didn't find it online.
5. Again Haskell as a replacement for DSL: the error messages give too
little hint about what's wrong, thus inadequate for DSL users. This foils
all the benefits of type
6. While googeling for solutions w.r.t. Haskell I saw a lot of "papers"
using scientific style. There's nothing wrong with papers but I'm glad that
cooking receipts usually use a
7. There's a lot of discussion w.r.t state, at least on this list. Is
threading state through many functions respectivley polluting many functions
with monads the solution?
My overall impression is that Haskell has a very nice syntax and offers
sophisticated concepts (i.e.non-strictness, type inference) making it
attractive for computer science.
But for most real-world applications it is intellectually too demanding (me
included). There is hope though. Haskell seems to be in a state of
adaptilbiliy. And it may influence
BTW: here's that sweet (but inefficient) Haskell code for the "game of nim":
> moves  = 
> moves (x:xs) = xs:[y:xs | y <- [1..x-1]] ++ [x:z | z <- moves xs]
> win  = True
> win x = foldr ((||) . not . win) False (moves x)
To find your next move, consider
> filter (not . win) (moves [1,2,2])
More information about the Haskell-Cafe