Seed Media Group

Search this blog

Profile

markcc.jpg
Mark Chu-Carroll (aka MarkCC) is a PhD Computer Scientist, who works for Google as a Software Engineer. My professional interests center on programming languages and tools, and how to improve the languages and tools that are used for building complex software systems.

Donors Choose

Other Information

Add this blog to my Technorati Favorites!

Recent Posts

Recent Comments

Categories

Blogroll

Old Topic Indices

Great Online Books

« The End of PEAR | Main | Why Haskell? »

Query for readers: Interested in Haskell?

Category: Chatter; Chatter > Meta; goodmath > programming
Posted on: November 25, 2006 7:18 PM, by Mark C. Chu-Carroll

As you may have noticed, lately, I've been fascinated by Haskell. I haven't done anything much in it until quite recently; it's been sitting in my to-do queue for a long time. This weekend, I was hacking away on a Haskell implementation of an interesting (but currently unimplemented) language from the Esolang wiki. For the most part, it went astonishingly smoothly, until I got to the point of putting things together, when I ran into a problem combining two monads, which is one of the typically difficult problems in real Haskell programming.

What surprised me a bit when I hit this is how hard it is to find an approachable source for the more advanced issues. If it's hard on a language geek like me, it's bound to be as bad or worse for a lot of other people who might be interested in Haskell.

So the thought hit me. If enough readers are interested, I can write an intermittent series of articles to teach Haskell, starting from the very early basics, all the way through to the messiest issues of monad transformers.

Are you interested? Interested enough that you'd be willing to accept a bit of a slowdown of the (already slow) topology posts to give me time to write it?

Let me know what you think, either in the comments below, or through email to markcc@gmail.com.

Ok, folks, I get the hint, you can stop emailing me! :-)

Since posting the question on a holiday weekend saturday night, I've gotten 50 responses, and they're unanimously in favor. I will start working on it, and the first parts should appear on the blog later this week.

Comments

#1

I'd be interested in reading your tutorial. Not that I'm likely to program in Haskell, but I think exposure to other programmings paradigms is essential.

I'd also be interested to know what you make of F#.

Posted by: Simon | November 25, 2006 7:43 PM

#2

Count me in. I'd love to see a good Haskell tutorial that goes from the basics up to monads.

Posted by: malpollyon | November 25, 2006 8:46 PM

#3

I know absolutely nothing about Haskell, but I'd love to learn. I've been a regular reader since before the SB move, and I'd love to learn Haskell from you. You have a knack for explaining complex things in an accessible way.

Posted by: David | November 25, 2006 9:07 PM

#4

I'm a regular reader, and would be very interested in a Haskell series. I'm keeping my fingers crossed that you get enough votes to do it!

Posted by: Jake | November 25, 2006 9:19 PM

#5

I'd love to see a tutorial on Haskell programming. It seems kind of annoying to me that most of the programs that you see in Haskell are examples of programs that functional programming proponents use as illustrative of functional style rather than programs that people write to solve particular problems or needs. I look forward to seeing your attempt.

Posted by: Mark VandeWettering | November 25, 2006 9:20 PM

#6

I'd also be interested in this.

I second MarkV's complaint about typical functional language tutorials. I don't need to write a fibonacci number generator. I do need to write programs that process input, produce output, and occasionally do things in order with error handling, and it seems I have to have a read to Chapter 28 in a Haskell book and earn a degree in category theory to learn how to do it.

Posted by: Eric Wallace | November 25, 2006 9:27 PM

#7

Yes, I'd love to learn Haskell.

Posted by: Alex | November 25, 2006 10:04 PM

#8

I'd be quite interested in a Haskell intro. I'd like to chime in and agree that I see tutorials that show trivial programs, and I see essays on Monads (which I really still don't get), but I don't see anything in between, and no tutorials USING monads, just defining them.

Posted by: Michael Chermside | November 25, 2006 10:06 PM

#9

I'd love it if you started from the basics. Like... even for people like me who haven't ever really used a functional language.

Posted by: Brett | November 25, 2006 10:09 PM

#10

For those interested in getting started immediately, there's a large collection of tutorials here:

* http://darcs.haskell.org/yaht/yaht.pdf (Recommended intro)
* http://en.wikibooks.org/wiki/Haskell (Haskell wikibook)
* http://research.microsoft.com/%7Esimonpj/Papers/marktoberdorf (Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign language calls) -- a classic text
* http://haskell.org/haskellwiki/Roll_your_own_IRC_bot (A monadic irc bot in a few lines)
* http://haskell.org/haskellwiki/Category:Tutorials (Haskell wiki articles)
* http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html (Good introduction to monads)
* http://uebb.cs.tu-berlin.de/~magr/pub/Transformers.en.html (Good introduction to combining monads)

And of course more and more at http://haskell.org. Feel free to drop by the #haskell irc channel at http://haskell.org/haskellwiki/IRC_channel if you like.

Posted by: dons | November 25, 2006 10:13 PM

#11

I'd be interested in seeing it. Also, if you haven't done so already, please come and join us on IRC! irc.freenode.net #haskell

I'd also be willing to help answer any questions you might have (though you'll also find me on the IRC channel, along with lots of others who like helping out and are probably more qualified than me much of the time).

As for combining monads, the best way to do this which is currently known about is to use monad transformers to build up the monad you're interested in, or one which is a little more general, and then to newtype that and use the newtype-deriving feature to derive instances of Functor, Monad, and any other classes which you want to come straight through. You can also then implement any additional functionality while hiding some of the more general operations (which gives you the ability to do things like consistency checking). It also helps save a lot of lifting operations which you'd have if you used the monad transformers directly. You then write a run-function for your given monad, and wrap the whole thing up in a module and don't export the data constructor for your newtype.

I intend to write a proper tutorial on that process, but if that made any sense at all, perhaps see if it works out in your particular example. Monads are really embedded domain specific languages, and the idea is you're not so much combining them as constructing one with the particular features that you're interested in.

One thing in which you might be interested is my Sudoku solver (which was written less as an example of how to solve Sudoku and more as an example of how to construct a monad), which is available at the top of http://www.haskell.org/haskellwiki/Sudoku . The overall structure of it is just what I described above.

Anyway, glad to hear about more people joining into the fun of using Haskell, and I hope to see you around!

Posted by: Cale Gibbard | November 25, 2006 10:18 PM

#12

Count me in too - I've been looking for a more advanced source of practical information than what I can occasionally get from asking around #haskell.

Specifically, I'd be interested in an introduction to Parsec. I've written something to parse a tiny language in Haskell (for a Turing machine simulator), but have never touched Parsec, let alone played around with it enough to figure out how it works.

Finally, I would like to see something connecting Haskell's concept of a Monad to your category theory bits from a few months ago. I still don't understand what a category theory monad is; however, I do understand what a Monad is in Haskell and so I would appreciate the connection. (Of course, I'll probably still not get anywhere until I re-read the category theory posts enough times to convince myself that there's something there to begin with)

Posted by: Daniel Martin | November 25, 2006 10:34 PM

#13

I'd be interested in the series, especially in it's parts concerning advanced monad programming. It could also be another place to point my friends who are interested in haskell.

P.S. I really enjoy your blog.

Posted by: Ivars | November 25, 2006 10:54 PM

#14

Dan Piponi has some excellent articles on Haskell monads (and other math stuff) at http://sigfpe.blogspot.com/

Posted by: Koray | November 25, 2006 11:15 PM

#15

I think it's a great idea. I am learning Haskell and I would be very interested in reading a tutorial titled "Haskell for former mathematicians who don't know category theory".

One great introductory article about monads takes the following approach: present a problem, then an naive solution an average person would come up with, then the real solution based on the full power and support of the language. I think this technique is very effective, especially for self-learners.

As for getting to practical applications soon, for most people this means doing IO, GUI and in general interaction with the Real World. I think the very nature of Haskell makes this an advanced topic and there is no way around it. I would be happy to find out I am wrong on that.

Posted by: Slawek K. | November 25, 2006 11:24 PM

#16

I too would be interested in whatever you have to say about Haskell...

Posted by: Capt. Jean-Luc Pikachu | November 25, 2006 11:37 PM

#17

Count me in as well. I have a textbook here I keep meaning to get to, but in the meantime...

Posted by: Chad Groft | November 26, 2006 12:13 AM

#18

Yess! I have even searched a couple of times the posts you wrote on Haskell just because they cleared up a few issues I had slight problems with. Great idea.

Posted by: vince | November 26, 2006 1:17 AM

#19

While I find the topology interesting, I know topology. I don't know Haskell. Do the tutorial.

Posted by: John Armstrong | November 26, 2006 1:21 AM

#20

Slawek K.: what about "Haskell for current mathematicians who do know category theory"? My interest in Haskell (and possibly that of others here) stems almost entirely from my interest in monoidally closed categories as a model of computation.

Posted by: John Armstrong | November 26, 2006 1:23 AM

#21

My son enjoys programming in Haskell. Is it the right language to answer a question by Franklin T. Adams-Watters about enumerating categories, namely:

"how many [concrete] categories are there with n morphisms and k [structureless] objects?
This table starts:

1
2 1
7 3 1
35 16 3 1

The first column is A058129, the number of monoids; the main diagonal is all 1's..."?

There's some argument about this in another web venue. I've provided an enumeration of the subset of directed graphs which can have loops and represent endofunctions which are "prime" (meaning neither the union of other prime endofunctions nor their categorical product).

But some who know Category Theory far better than I say it's a hard enumeration.

It seems that Haskell has the right semantics and metalanguage and syntax to do this in a fairly straightforward way. A good answer here gets passed on to Franklin T. Adams-Watters and probably cites you by name and email address in that other venue.

Posted by: Jonathan Vos Post | November 26, 2006 2:55 AM

#22

Could be nice to see - the only functional programming language, I have worked with, is Standard ML, so it would be interesting to learn about Haskell.

Posted by: Kristjan Wager | November 26, 2006 3:29 AM

#23

Yeah.. sure count me in too..

Posted by: Vishnu Vyas | November 26, 2006 6:01 AM

#24

Haskell is a lovely langauge, a shame that it is not more widely used. So yeah, a blog tutorial on it would be great, perhaps that can widen the userbase a bit.

Posted by: Linus | November 26, 2006 6:22 AM

#25

I'm with John Armstrong on this: I got sucked into the haskell community by reading Dan Piponi's blog articles; and what really, really catches my eye is the importance of category theory for the language.

And one of the things I've been really missing since I started reading up on it was the language explained to someone who's already reasonably fluent in category theory.

Posted by: Mikael Johansson | November 26, 2006 6:23 AM

#26

It's your fault that I fell in love with Haskell (from your Scheme vs. Haskell post a few weeks ago), so I'd dig(g) any more knowledge you'd care to share about it. :-)

Thanks in advance.

Posted by: Gerald Squelart | November 26, 2006 7:08 AM

#27

Yes, I'd love to see articles and tutorials on Haskell here.

Posted by: Curt Sampson | November 26, 2006 10:24 AM

#28

I am interested in learning haskell I would definetly read your tutorial posts.

though I have to admit topology is more interesting, but I find it much easier to learn programming languages from blogs than hardcore math. So overall I would definetly find a Haskell blog tutorial more valuable than a topology articles.

Posted by: Brian | November 26, 2006 12:04 PM

#29

I'm very much interested in a series teaching Haskell -- you seem to be a very good teacher, so I suppose that I will learn something from you. What I'm specifically interested in is how I can use Haskell as a vehicle for implementing a interpreter for Category Theory. Or: How close is Haskell in being a pure CT programming language?

Posted by: DominikusH | November 26, 2006 3:41 PM

#30

I'd like to start a toy project in a functional language, and I'm wondering which language to pick. At the moment I'd rather try F#, which provides access to all the existing .NET libraries, than Haskell, for which I have no idea how to do a desktop GUI, a Web interface, socket-based networking, XML reading and writing, or other standard stuff that I may need in the project at some point.

So my questions to you:

- does Haskell have well-developed libraries for networking, HTML and XML processing, database access, and desktop GUIs?
- where does Haskell shine, compared to other functional languages, such as F#?

Posted by: Reinier Post | November 27, 2006 8:48 AM

#31

PS the toy project I have in mind is a system for playing board games. A game engine controls the game state and the possible moves; clients connect to the game engine to see the game state and execute moves. Version 0.1 would be a tic-tac-toe engine with 1 human player (using a command line interface) and 1 automatic player.

Posted by: Reinier Post | November 27, 2006 9:00 AM

#32

I hope your Monad explanation is good. I've read a half dozen introductions to them and I almost always get lost.

Usually, the Maybe example makes sense, but then they go on to something a little more advanced and I end up somewhere in Siberia.

Posted by: Danno | November 27, 2006 8:14 PM

Post a Comment

(Email is required for authentication purposes only. Comments are moderated for spam, your comment may not appear immediately. Thanks for waiting.)





Having problems commenting? (UPDATED)

Blogs in the Network

Advertisement

Top Five: Readers' Picks

Search All Blogs