ANN: The Typeclassopedia, and request for feedback

Hi all, If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader. Here's the abstract: The standard Haskell libraries feature a number of type classes with algebraic or categorical underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs. The goal of this article is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading. My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here: http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdf Also see my blog post for a bit more info: http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feed... happy haskelling! -Brent

Hi Brent, I want to congratulate you on your article! An excellent piece of work which should be compulsory reading for all serious haskell programmers :) My one suggestion would be that you expand on some of the examples; for example, in the monoid section, you refer to various cool applications of Monoid, but do not include them in the paper. Dedicated readers might follow up on your (rather long!) references list, but many will not, and it is a shame if they miss the elegance that Monoid permits. I think that if you would inline some of these examples, the article would be even better :) Thanks for writing it! Edsko

Brent Yorgey wrote:
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here:
http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdf
Also see my blog post for a bit more info:
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feed...
This is really great! Thanks for doing this. Regards, -- Jochem Berndsen | jochem@functor.nl GPG: 0xE6FABFAB

Wonderful, thank you!
On Mon, Feb 16, 2009 at 4:29 AM, Brent Yorgey
Hi all,
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader. Here's the abstract:
The standard Haskell libraries feature a number of type classes with algebraic or categorical underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs.
The goal of this article is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading.
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here:
http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdf
Also see my blog post for a bit more info:
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feed...
happy haskelling! -Brent _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Brent Yorgey wrote:
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader.
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication.
Splendid and outstanding! I do, however, wonder about the publication format. Wouldn't a hyperlinked collection of pages be more suitable for The Typeclassopedia? I imagine something like one HTML page for each class, references as inline hyperlinks and the class diagram being the hub, with each box being a link to the corresponding page. Of course, the drawback of a more hypertext-like format would be that it can't be published in the gem that is the Monad.Reader. :( Or can it? Thanks to the Simple Permissive License under which the Monad.Reader publishes, this is not necessarily a dichotomy, though. We can always convert it to hypertext afterwards. Regards, apfelmus -- http://apfelmus.nfshost.com

Super! Also, best definition of bottom I've yet seen -- "ignoring _|_,
which is a party pooper". Like good code, it's short, to the point, and
obviously correct.
Thanks for this. It's great to have it all in one place, and so
entertainingly presented.
cheers,
Fraser.
On Mon, Feb 16, 2009 at 10:29 AM, Brent Yorgey
Hi all,
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader. Here's the abstract:
The standard Haskell libraries feature a number of type classes with algebraic or categorical underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs.
The goal of this article is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading.
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here:
http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdfhttp://www.cis.upenn.edu/%7Ebyorgey/papers/typeclassopedia-draft-090216.pdf
Also see my blog post for a bit more info:
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feed...
happy haskelling! -Brent _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Mon, 2009-02-16 at 15:30 +0100, Fraser Wilson wrote:
Super! Also, best definition of bottom I've yet seen -- "ignoring _| _, which is a party pooper". Like good code, it's short, to the point, and obviously correct.
This brings up something I've thought about: On page 8, it is said that Pointed doesn't need to be checked because the theorem comes for free, but the free theorems paper was based upon total functions only; does having _|_ affect the free theorem for Pointed? - George

Am Dienstag, 17. Februar 2009 00:32 schrieb George Pollard:
On Mon, 2009-02-16 at 15:30 +0100, Fraser Wilson wrote:
Super! Also, best definition of bottom I've yet seen -- "ignoring _| _, which is a party pooper". Like good code, it's short, to the point, and obviously correct.
This brings up something I've thought about: On page 8, it is said that Pointed doesn't need to be checked because the theorem comes for free, but the free theorems paper was based upon total functions only; does having _|_ affect the free theorem for Pointed?
This was my question to Janis Voigtländer after his HaL 3 talk. He said that the free theorem stuff also holds in the presence of _|_, it’s just a bit more complicated to prove it. At least, this is how I understood it. :-) Best wishes, Wolfgang

* Wolfgang Jeltsch
Am Dienstag, 17. Februar 2009 00:32 schrieb George Pollard:
On Mon, 2009-02-16 at 15:30 +0100, Fraser Wilson wrote:
Super! Also, best definition of bottom I've yet seen -- "ignoring _| _, which is a party pooper". Like good code, it's short, to the point, and obviously correct.
This brings up something I've thought about: On page 8, it is said that Pointed doesn't need to be checked because the theorem comes for free, but the free theorems paper was based upon total functions only; does having _|_ affect the free theorem for Pointed?
This was my question to Janis Voigtländer after his HaL 3 talk. He said that the free theorem stuff also holds in the presence of _|_, it’s just a bit more complicated to prove it. At least, this is how I understood it. :-)
This paper was recently cited in -cafe; doesn't it help here? http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.59.8232 -- Roman I. Cheplyaka :: http://ro-che.info/ "Don't let school get in the way of your education." - Mark Twain

Am Montag, 16. Februar 2009 10:29 schrieb Brent Yorgey:
Hi all,
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader.
Good decision (not in any way suggesting that HWN isn't a great thing, too)!
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-fee dback/
happy haskelling! -Brent
Hah, seems I'm the first to point out a flaw in it: Bottom of page 13: "Also, note that although _ >> m = m would be a type-correct implementation of (>>), it" The remainder of the sentence is missing. I'm not yet through it, but so far it has been excellent. Cheers, Daniel

On Mon, Feb 16, 2009 at 11:53 AM, Daniel Fischer
Hah, seems I'm the first to point out a flaw in it:
Bottom of page 13: "Also, note that although _ >> m = m would be a type-correct implementation of (>>), it" The remainder of the sentence is missing.
Sorry, I've already reported this one, it's waiting for moderation on the blog post ;). -- Felipe.

Positively brilliant. What else can be said? Time for Brent to sign a
"Haskell recipes" deal with O'Reilly (or whatever the next normal book
should be).
On Mon, Feb 16, 2009 at 4:29 AM, Brent Yorgey
Hi all,
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader. Here's the abstract:
The standard Haskell libraries feature a number of type classes with algebraic or categorical underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs.
The goal of this article is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading.
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here:
http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdf
Also see my blog post for a bit more info:
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feed...
happy haskelling! -Brent _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Brent Yorgey wrote:
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here
Excellent work. I like the way this is a single, thorough documentation that presents all the abstractions in a single, coherant account. Kudos. Some others have suggested a set of hyperlinked articles; maybe there are actually two seperate use-cases here? The document as it stands is a great beginning-to-end account of this stuff, but perhaps a seperate reference document, nicely hyperlinked, would be nice too? There's *a lot* of type signatures to keep straight in your head, and I imagine it's quite easy to muddle the different classes up in your head while you're still new to them. I'd echo others' comments about more examples; some of these things are, by definition, seriously abstract. Concrete examples can help. (Although, obviously, picking good examples isn't as easy as it sounds...) Similarly, there are lots and *lots* of references. This is a good thing, IMHO. But I do feel that a few of them could be expanded a little more in-line. Obviously there's no point in you duplicating everything that somebody else has already said, but maybe a little more detail? On the other hand, maybe this just indicates that somebody needs to write summaries for the other topics similar to the excellent one we have here! :-D There are a few little glitches here and there. Since this is only a draft, I presume you know that. (E.g., an example uses <$> before you've meantioned what it does, there's some text that says something like "a b c is an arrow that takes an a and returns a c". Little things like that.) I do have one little question. Let me see if I can find the quote... Ah, here we go: "The WrappedMonad and WrappedArrow constructors witness the fact that any Monad and any Arrow can be made into an Applicative." I don't really understand that sentence. Care to elaborate?

* On Monday, February 16 2009, Andrew Coppin wrote:
I do have one little question. Let me see if I can find the quote... Ah, here we go:
"The WrappedMonad and WrappedArrow constructors witness the fact that any Monad and any Arrow can be made into an Applicative."
I don't really understand that sentence. Care to elaborate?
imho, the original wording is concise and clear, but with more common words: Arrow and Monad are special cases of Functor and Applicative, so you can make an Applicative out of any Arrow or Monad. Those newtypes have Applicative instances which you can use for an arbitrary Monad or Arrow, when they are inside that newtype. You could also clarify which part you don't understand (the meanings of constructor, witness, the classes involved, etc.). If the linked haddock documentation had links to colorized source code (present in previous versions), then looking up these instances might be easier.

Natural numbers under min don't form a monoid, only naturals under max do (so you can have a zero element) Brent Yorgey wrote:
Hi all,
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader. Here's the abstract:
The standard Haskell libraries feature a number of type classes with algebraic or categorical underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs.
The goal of this article is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading.
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here:
http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdf
Also see my blog post for a bit more info:
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-fee dback/
happy haskelling! -Brent _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Isaac Dupree wrote:
Natural numbers under min don't form a monoid, only naturals under max do (so you can have a zero element)
Though, FWIW, you can use Nat+1 with the extra value standing for Infinity as the identity of min (newtype Min = Maybe Nat). I bring this up mainly because it can be helpful to explain how we can take the "almost monoid" of min@Nat and monoidize it. Showing how this is similar to and different from max@Nat is enlightening. Showing the min monoid on negative naturals with 0 as the identity, and no need for the "special" +1 value, would help drive the point home. (Also, the min/max duality is mirrored in intersection/union on sets where we need to introduce either the empty set (usually trivial) or the universal set (usually overlooked).) Or maybe that would be better explained in a reference rather than the main text. -- Live well, ~wren

On Mon, Feb 16, 2009 at 8:13 PM, wren ng thornton
Isaac Dupree wrote:
Natural numbers under min don't form a monoid, only naturals under max do (so you can have a zero element)
Though, FWIW, you can use Nat+1 with the extra value standing for Infinity as the identity of min (newtype Min = Maybe Nat).
Indeed, as well as you can use lazy naturals with infinity as the unit: data Nat = Zero | Succ Nat infinity = Succ infinity min Zero _ = Zero min _ Zero = Zero min (Succ x) (Succ y) = Succ (min x y)
I bring this up mainly because it can be helpful to explain how we can take the "almost monoid" of min@Nat and monoidize it. Showing how this is similar to and different from max@Nat is enlightening. Showing the min monoid on negative naturals with 0 as the identity, and no need for the "special" +1 value, would help drive the point home. (Also, the min/max duality is mirrored in intersection/union on sets where we need to introduce either the empty set (usually trivial) or the universal set (usually overlooked).)
Or maybe that would be better explained in a reference rather than the main text.
-- Live well, ~wren
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I'm really confused that when I replied (not reply-to-all, not reply-to-list, just reply) to that message, it went to the lists and not to you Brent! (KMail 1.10.3) -- so I totally edited the "To" lines, to send this message... Brent Yorgey wrote:
Hi all,
If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just submitted for publication in the Monad.Reader. Here's the abstract:
The standard Haskell libraries feature a number of type classes with algebraic or categorical underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs.
The goal of this article is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading.
My hope is that this will be a valuable resource to the Haskell community, especially those who are learning. Any feedback would be greatly appreciated, especially if it helps improve the article before publication. A draft can be found here:
http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdf
Also see my blog post for a bit more info:
http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-fee dback/
happy haskelling! -Brent _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Am Dienstag, 17. Februar 2009 03:42 schrieb Isaac Dupree:
I'm really confused that when I replied (not reply-to-all, not reply-to-list, just reply) to that message, it went to the lists and not to you Brent! (KMail 1.10.3) -- so I totally edited the "To" lines, to send this message...
Isn’t this just because of the Reply-To: header line which is inserted by mailman? Best wishes, Wolfgang

Hey, Another comment: I feel that the Const datatype in Control.Applicative deserves to be better-known; you might mention it in your article, especially since it connects Applicative with Monoid. (In Conor's article, he calls that datatype 'Accy' and shows why it is so useful). Edsko
participants (17)
-
Adam Vogt
-
Andrew Coppin
-
Andrew Wagner
-
Brent Yorgey
-
Daniel Fischer
-
Daniel Peebles
-
Edsko de Vries
-
Felipe Lessa
-
Fraser Wilson
-
George Pollard
-
Heinrich Apfelmus
-
Isaac Dupree
-
Jochem Berndsen
-
Luke Palmer
-
Roman Cheplyaka
-
Wolfgang Jeltsch
-
wren ng thornton