Jim on 2 Feb 2010 08:15:58 -0800 |
Hi Dan, Thanks for your talk last night. It was great to see some Haskell code doing some realistic stuff like hitting the DB. (As opposed to the more abstract Haskell example one generally encounters) Also the non-mystical approach to monadic operations is refreshing. I've been thinking about a couple items: 1. Tail Call Optimization in Haskell I'm quite certain that it works fine. See dons' comment http://www.reddit.com/comments/6xnk5/ive_got_two_weeks_of_vacation_coming_up_should_i/c055b9w Where it gets confusing is that often, my first run at a haskell tail recursive function lazily accumulates something against a very large list, resulting in a stack overflow. But that's due to inappropriate laziness, not lack of optimized tail recursion. Then I replace foldl with foldl' and things work out fine- strictly accumulating a lazy list. I think Mattias might have said something to this effect last night- "the two issues are orthogonal". However, my head was spinning too much from all the abstractions to process it. Re-reading the Real World Haskell section on "Strictness and Tail Recursion" (pg 571 in the printed version) it does seem that the issues are conflated, which is uncharacteristicaly confusing for this book. 2. Let vs. Where / Strict vs Lazy I can't find anything to support the idea that one is lazy and the other strict. http://www.haskell.org/haskellwiki/Let_vs._Where It seems like either one could be lazy or strict depending on how its coded. The major difference seems to the scope of the bindings: "let..in" is an _expression_, but "where" applies to the preceding block- which doesn't have to be an _expression_. Its strange that I've been able to use both without clearly understanding the difference... 3. I've found the "Hoogle" search engine very helpful. http://www.haskell.org/hoogle/ If you just enter a type signature, it finds all the matching functions. --Jim On Mon, Feb 1, 2010 at 4:07 PM, Dan Mead <d.w.mead@gmail.com> wrote: Hey all -- --Jim
|
|