[Haskell-cafe] learning advanced haskell
Chris Eidhof
chris at eidhof.nl
Mon Jun 14 04:32:39 EDT 2010
On 14 jun 2010, at 07:42, Aran Donohue wrote:
> Hi Cafe,
>
> I've been doing Haskell for a few months, and I've written some mid-sized programs and many small ones. I've read lots of documentation and many papers, but I'm having difficulty making the jump into some of the advanced concepts I've read about.
>
> How do people build intuitions for things like RankNTypes and arrows? (Is the answer "Get a PhD in type theory?") Normally I learn by coding up little exercise programs, but for these I don't have good intuitions about the kinds of toy problems I ought to try to solve that would lead me to understand these tools better.
I learned my advanced stuff in two ways:
1. I followed excellent courses at Utrecht University, where they teach (among other things) advanced functional programming.
2. I just read a lot, which is a lot slower than 1.
3. By building my own programs, I inevitably find my self stuck and while searching for a solution, sometimes these concepts are the answer. For example, once I had a monadic program and I wanted to serialize/inspect the program, which turned out to be impossible in my case. The solution was to write it down using arrows (thus I had to learn arrows and also arrow-notatation). I think (for me) this is the most powerful way to learn new advanced concepts. I need practical problems to keep myself motivated.
> For systems like Template Haskell and SYB, I have difficulty judging when I should use Haskell's simpler built-in semantic abstractions like functions and typeclasses and when I should look to these other mechanisms.
Sometimes Template Haskell or SYB is the answer, and it's a matter of style, but I try to avoid them as much as possible. I find that generic programming in the style of regular [1] or emgm [2] is often much simpler.
Some more tips: subscribe to planet haskell, if you haven't done that already. Try to find ICFP/JFP/etc papers online that interest you.
-chris
[1]: http://hackage.haskell.org/package/regular
[2]: http://hackage.haskell.org/package/emgm
More information about the Haskell-Cafe
mailing list