Categorized Weaknesses from the State of Haskell 2011 Survey

Hello all, I did a followup analysis of the free-form responses to "What is Haskell's most glaring weakness / blind spot / problem" in the State of Haskell 2011 Survey. The article is up at: http://nickknowlson.com/blog/2011/09/12/haskell-survey-categorized-weaknesse... I think it has a lot of interesting information in it - I hope some others will find it useful now too. Cheers, Nick

Replying to someone's compliant in the first section: Malcolm Wallace and Colin Runciman's ICFP99 paper functioned well as a tutorial for HaXml when I used it - maybe it is a bit out of date now? HaXml is hardly a dire case.

Stephen Tetley wrote:
Replying to someone's compliant in the first section:
Malcolm Wallace and Colin Runciman's ICFP99 paper functioned well as a tutorial for HaXml when I used it - maybe it is a bit out of date now? HaXml is hardly a dire case.
... for the right audience. I guess the point is that the person complaining could not understand the existing documentation. Quote: "This type of documentation may seem to “fall out” from a mathematically-oriented understanding of the library (such as haxml’s combinator scheme, or the concept of “lenses” in fclabels), but an application programmer does not have time to work through proofs of lens properties and then figure out what they might be good for in a program. Instead, the application programmer needs cookbook-style documentation to get something up and running, and then s/he can come to understand and make use of the underlying math." I'm not sure whether it's the job of library documentation to teach mathematical understanding, but cookbook-style examples seem very valuable to me. For instance, I think that the Happstack tutorial http://happstack.com/docs/crashcourse/index.html is excellent in this regard. (Personally, a good method for writing this kind of stuff is to assume that the reader has almost zero attention span. Then, I am forced to communicate the most useful points in the first few paragraphs, because my hypothetical reader probably won't read any further than that. Of course, the resulting text will be very useful to readers with a high attention span, too.) Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com

I would appreciate is a few paragraphs in the toplevel haddock page or module that describe the general architecture and layout of the modules, as well as the typical entry points. Since the module system doesn't have a notion of private modules and it's common to re-export symbols, it can be unclear where to start, which modules to look at, and why it is the author chose that particular decomposition for the functions. Overall design and architecture is hard to get out of the code. I think the same goes for each module. It's frustrating when I want to figure out how something works, and each module just has a giant chunk of license copy-paste at the top.

On 09/12/11 17:48, Stephen Tetley wrote:
Replying to someone's compliant in the first section:
Malcolm Wallace and Colin Runciman's ICFP99 paper functioned well as a tutorial for HaXml when I used it - maybe it is a bit out of date now? HaXml is hardly a dire case.
The paper is out-of-date, so it's worse than useless: you'll waste your time figuring out that it's wrong, and you still won't know how to do anything. There's not one single example anywhere that just shows you how to read or write a damned XML file. HaXml is what prompted me to start this page (bad language warning, if it ain't obvious): http://michael.orlitzky.com/articles/fuck_you.php If there were anything approaching a physical manifestation of HaXml, I would've strangled it.

On 13 Sep 2011, at 18:59, Michael Orlitzky wrote:
Malcolm Wallace and Colin Runciman's ICFP99 paper functioned well as a tutorial for HaXml when I used it - maybe it is a bit out of date now? HaXml is hardly a dire case.
The paper is out-of-date, so it's worse than useless: you'll waste your time figuring out that it's wrong, and you still won't know how to do anything.
There's not one single example anywhere that just shows you how to read or write a damned XML file. If there were anything approaching a physical manifestation of HaXml, I would've strangled it.
I am the first to admit that HaXml's documentation is not as good as it could be, and I am sorry that you have had a bad experience. One thing I am puzzled about, is just how extremely difficult it must be, to click on "Detailed documentation of the HaXml APIs" from the HaXml homepage, look for a moment until you see "Text.XML.HaXml.Parse" in the list of modules, click on it, and find, right at the top of the page, a function that parses a String into an XML document tree. It is absolutely true that finding the reverse conversion (XML tree to String) is more obscure, being either the two-stage process of first using "Text.XML.HaXml.Pretty" to convert to a Doc, then "Text.PrettyPrint.HughesPJ" to render to a String; or alternatively the one-shot conversion in "Text.XML.HaXml.Verbatim". Neither module name is as clear as it should be for a beginner, but I can't think of better ones. Plus, it requires some knowledge of the ecosystem, for instance that pretty-printing is a common technique for producing textual output. In fact, my wish as a library author would be: please tell me what you, as a beginner to this library, would like to do with it when you first pick it up? Then perhaps I could write a tutorial that answers the questions people actually ask, and tells them how to get the stuff done that they want to do. I have tried writing documentation, but it seems that people do not know how to find, or use it. Navigating an API you do not know is hard. I'd like to signpost it better. Regards, Malcolm

+1 for Heinrich Apfelmus's suggestion of cookbook recipes.
In other language communities I see a lot of "quickstart" guides designed to
help someone get up and running without a full understanding of what they're
doing, presumably with the hope that once they get started it will provide
the motivation to keep learning. But admittedly, and for good reason,
learning the how without the why seems to run counter to the general
mentality of the Haskell community.
For widely used libraries it'd be nice to a see a supporting wiki page
broken into sections like conceptual overview, how to navigate the API if
it's extensive, tutorials, and cookbook recipes. Motivating the community to
contribute supporting documentation could alleviate some of the burden for
library writers. Frequently updated and extensive community docs can also
help newcomers decide which library to start with for a given task, rather
than relying purely on Hackage descriptions. I'm slowly assembling
supporting docs of this kind for the libraries I use the most, and if anyone
is working on something similar I'm happy to help by trying out the
tutorials and giving feedback.
Thanks!
Eric
On Tue, Sep 13, 2011 at 2:15 PM, Malcolm Wallace
On 13 Sep 2011, at 18:59, Michael Orlitzky wrote:
Malcolm Wallace and Colin Runciman's ICFP99 paper functioned well as a tutorial for HaXml when I used it - maybe it is a bit out of date now? HaXml is hardly a dire case.
The paper is out-of-date, so it's worse than useless: you'll waste your time figuring out that it's wrong, and you still won't know how to do anything.
There's not one single example anywhere that just shows you how to read or write a damned XML file. If there were anything approaching a physical manifestation of HaXml, I would've strangled it.
I am the first to admit that HaXml's documentation is not as good as it could be, and I am sorry that you have had a bad experience.
One thing I am puzzled about, is just how extremely difficult it must be, to click on "Detailed documentation of the HaXml APIs" from the HaXml homepage, look for a moment until you see "Text.XML.HaXml.Parse" in the list of modules, click on it, and find, right at the top of the page, a function that parses a String into an XML document tree.
It is absolutely true that finding the reverse conversion (XML tree to String) is more obscure, being either the two-stage process of first using "Text.XML.HaXml.Pretty" to convert to a Doc, then "Text.PrettyPrint.HughesPJ" to render to a String; or alternatively the one-shot conversion in "Text.XML.HaXml.Verbatim". Neither module name is as clear as it should be for a beginner, but I can't think of better ones. Plus, it requires some knowledge of the ecosystem, for instance that pretty-printing is a common technique for producing textual output.
In fact, my wish as a library author would be: please tell me what you, as a beginner to this library, would like to do with it when you first pick it up? Then perhaps I could write a tutorial that answers the questions people actually ask, and tells them how to get the stuff done that they want to do. I have tried writing documentation, but it seems that people do not know how to find, or use it. Navigating an API you do not know is hard. I'd like to signpost it better.
Regards, Malcolm
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 09/13/2011 05:15 PM, Malcolm Wallace wrote:
I am the first to admit that HaXml's documentation is not as good as it could be, and I am sorry that you have had a bad experience.
Sorry for the tirade =) That was a while ago, but I definitely felt some sympathy for the guy in the quote.
One thing I am puzzled about, is just how extremely difficult it must be, to click on "Detailed documentation of the HaXml APIs" from the HaXml homepage, look for a moment until you see "Text.XML.HaXml.Parse" in the list of modules, click on it, and find, right at the top of the page, a function that parses a String into an XML document tree.
As someone who just wants to parse an XML file, here's what happens. First, I click on the API docs. I'm presented with a list: * Text o XML + Text.XML.HaXml # Text.XML.HaXml.ByteStringPP # Text.XML.HaXml.Combinators # DtdToHaskell * Text.XML.HaXml.DtdToHaskell.Convert * Text.XML.HaXml.DtdToHaskell.Instance * Text.XML.HaXml.DtdToHaskell.TypeDef # Text.XML.HaXml.Escape # Html * Text.XML.HaXml.Html.Generate * Text.XML.HaXml.Html.Parse * Text.XML.HaXml.Html.ParseLazy * Text.XML.HaXml.Html.Pretty # Text.XML.HaXml.Lex # Text.XML.HaXml.Namespaces # Text.XML.HaXml.OneOfN # Text.XML.HaXml.Parse # Text.XML.HaXml.ParseLazy # Text.XML.HaXml.Posn # Text.XML.HaXml.Pretty # Text.XML.HaXml.SAX # Schema * Text.XML.HaXml.Schema.Environment * Text.XML.HaXml.Schema.HaskellTypeModel * Text.XML.HaXml.Schema.NameConversion * Text.XML.HaXml.Schema.Parse * Text.XML.HaXml.Schema.PrettyHaskell * Text.XML.HaXml.Schema.PrimitiveTypes * Text.XML.HaXml.Schema.Schema * Text.XML.HaXml.Schema.TypeConversion * Text.XML.HaXml.Schema.XSDTypeModel # Text.XML.HaXml.ShowXmlLazy # Text.XML.HaXml.TypeMapping # Text.XML.HaXml.Types # Text.XML.HaXml.Util # Text.XML.HaXml.Validate # Text.XML.HaXml.Verbatim # Text.XML.HaXml.Wrappers # Text.XML.HaXml.XmlContent * Text.XML.HaXml.XmlContent.Haskell * Text.XML.HaXml.XmlContent.Parser # Xtract * Text.XML.HaXml.Xtract.Combinators * Text.XML.HaXml.Xtract.Lex * Text.XML.HaXml.Xtract.Parse Jesus! /You/ know that I want to look in Text.XML.HaXml.Parse, but /I/ don't. Let's say I choose the first link: Text.XML.HaXml. It's a list of modules, along with their documentation. All blank! Hitting the back button. The first thing I notice is that there seems to be specialized parser modules for different content types, e.g. Text.XML.HaXml.Html.Parse. Maybe I want Text.XML.HaXml.Schema.Parse? I mean, I want to parse something with a schema, right? Nope, it's for parsing XSDs. How about Text.XML.HaXml.Util? This looks right... Only a small module containing some helper functions to extract xml content - I would have added this to Types but I've put it into an additional module - to avoid circular references (Verbatim - Types) and it's got a function called docContent which is supposed to "Get the main element of the document..." Great. Its type is, docContent :: i -> Document i -> Content i so now, to have any hope of using this function (or figure out that I'm in the wrong place entirely), I have to go figure out what those types are. Document has one constructor, Document Prolog (SymTab EntityDef) (Element i) [Misc] which leads me to, Prolog (Maybe XMLDecl) [Misc] (Maybe DocTypeDecl) [Misc] XMLDecl VersionInfo (Maybe EncodingDecl) (Maybe SDDecl) type VersionInfo = String newtype EncodingDecl = EncodingDecl String type SDDecl = Bool data Misc = Comment Comment | PI ProcessingInstruction type Comment = String type ProcessingInstruction = (PITarget, String) type PITarget = String data DocTypeDecl = DTD QName (Maybe ExternalID) [MarkupDecl] data QName = N Name | QN Namespace Name type Name = String data Namespace = Namespace {nsPrefix :: String, nsURI :: String} data ExternalID = SYSTEM SystemLiteral | PUBLIC PubidLiteral SystemLiteral newtype SystemLiteral = SystemLiteral String newtype PubidLiteral = PubidLiteral String data MarkupDecl = Element ElementDecl | AttList AttListDecl | Entity EntityDecl | Notation NotationDecl | MarkupMisc Misc data ElementDecl = ElementDecl QName ContentSpec data ContentSpec = EMPTY | ANY | Mixed Mixed | ContentSpec CP ... ... most of which are completely undocumented. I have no idea what any of this stuff means! As a result, I don't know what the 'docContent' function does, or whether or not I'm even looking in the right place. At this point, I'm probably googling for blog entries and wondering why I'm wasting my time when all I really need is a "hello, world" example. If by some miracle I do discover Text.XML.HaXml.Parse.xmlParse (do I want ParseLazy? What's the difference?) I can get myself a Document. Now what? Do I try to understand that giant type hierarchy above? There's nothing else in the Parse module that looks useful. All of the good stuff, it turns out, is in the ambiguously-named Text.XML.HaXml.Combinators. Ok, the paper helps a little bit here, if you want to include a few years of college as a prerequisite for parsing XML. There are some things here that look promising, like 'elm' and 'tag'. However, they all have mysterious types: elm, txt :: CFilter i What's a CFilter? type CFilter i = Content i -> [Content i] The Content type actually contains words I recognize! Awesome! But wait, I don't have Content! I have a Document! How do I get Content out of my Document? Argh... This is bringing back bad memories =)
In fact, my wish as a library author would be: please tell me what you, as a beginner to this library, would like to do with it when you first pick it up? Then perhaps I could write a tutorial that answers the questions people actually ask, and tells them how to get the stuff done that they want to do. I have tried writing documentation, but it seems that people do not know how to find, or use it. Navigating an API you do not know is hard. I'd like to signpost it better.
I was trying to parse user timelines from the Twitter API. I threw away most stuff, but wanted to go through the tree and extract the name, body, date, etc. from the individual entries. What's really missing in my opinion is an overview of how everything fits together, along with examples. There are a couple "big" types that you need to know to use the library. Document, Content, and CFilter come to mind. All of those should be well-documented: * What do they represent? * How do they fit together? * Where can I get them, i.e. what functions produce them? * What can I do with them? The examples don't need to be too complicated. How to read/write a file, how to get an element's name, attributes, and text, etc. Anything is better than nothing. Most of the examples in blog posts and other people's code are out of date; while the differences may be small, a new user has no way of knowing that. GHC is just going to throw a type error that may as well be Chinese.

On Sep 13, 2011, at 7:38 PM, Michael Orlitzky wrote:
One thing I am puzzled about, is just how extremely difficult it must be, to click on "Detailed documentation of the HaXml APIs" from the HaXml homepage, look for a moment until you see "Text.XML.HaXml.Parse" in the list of modules, click on it, and find, right at the top of the page, a function that parses a String into an XML document tree.
As someone who just wants to parse an XML file, here's what happens. First, I click on the API docs. I'm presented with a list:
* Text o XML + Text.XML.HaXml # Text.XML.HaXml.ByteStringPP # Text.XML.HaXml.Combinators # DtdToHaskell * Text.XML.HaXml.DtdToHaskell.Convert
<snip> I think you make an important point here. As a beginner myself, I am often surprised by the sparse first impression of modules that hackage offers. To a beginner, the one sentence introduction often using domain-specific language is thwarting. Compare hackage to CPAN or Sphinx documentation which present pages of examples covering all programmer-visible interfaces and the difference is clear: hackage is a module repository first and a documentation browser last. Cheers, M

Malcolm Wallace wrote:
In fact, my wish as a library author would be: please tell me what you, as a beginner to this library, would like to do with it when you first pick it up? Then perhaps I could write a tutorial that answers the questions people actually ask, and tells them how to get the stuff done that they want to do. I have tried writing documentation, but it seems that people do not know how to find, or use it. Navigating an API you do not know is hard. I'd like to signpost it better.
From my experience, people are very good at learning patterns from examples, so a list of simple examples with increasing difficulty or a cookbook-style tutorial work very well. In comparison, learning from general descriptions is much harder and usually done by learning from examples anyway. A case in point might by my own reactive-banana library. http://haskell.org/haskellwiki/Reactive-banana I have extensive haddocks and many examples ranging from simple to complicated http://haskell.org/haskellwiki/Reactive-banana/Examples but so far, I never wrote a tutorial or introductory documentation. Curiously, instead of sending complaints, people send me suggestions and code. I interpret this as a sign that my library is easy to understand (if you know Applicative Functors, that is) even though a key part of the documentation is still missing. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com

I think a few examples can go a long way.
I remembered seeing a lot of requests for examples in the results, so I went
back and skimmed the spreadsheet. I found that 11 of the 34 responses under
Library Documentation explicitly called out examples as desirable.
Combined with Heinrich's experience, this sounds pretty promising to me.
Cheers,
Nick
On 15 September 2011 05:24, Heinrich Apfelmus
Malcolm Wallace wrote:
In fact, my wish as a library author would be: please tell me what you, as a beginner to this library, would like to do with it when you first pick it up? Then perhaps I could write a tutorial that answers the questions people actually ask, and tells them how to get the stuff done that they want to do. I have tried writing documentation, but it seems that people do not know how to find, or use it. Navigating an API you do not know is hard. I'd like to signpost it better.
From my experience, people are very good at learning patterns from examples, so a list of simple examples with increasing difficulty or a cookbook-style tutorial work very well. In comparison, learning from general descriptions is much harder and usually done by learning from examples anyway.
A case in point might by my own reactive-banana library.
http://haskell.org/**haskellwiki/Reactive-bananahttp://haskell.org/haskellwiki/Reactive-banana
I have extensive haddocks and many examples ranging from simple to complicated
http://haskell.org/**haskellwiki/Reactive-banana/**Exampleshttp://haskell.org/haskellwiki/Reactive-banana/Examples
but so far, I never wrote a tutorial or introductory documentation. Curiously, instead of sending complaints, people send me suggestions and code. I interpret this as a sign that my library is easy to understand (if you know Applicative Functors, that is) even though a key part of the documentation is still missing.
Best regards, Heinrich Apfelmus
-- http://apfelmus.nfshost.com
______________________________**_________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe
participants (8)
-
A.M.
-
Eric Rasmussen
-
Evan Laforge
-
Heinrich Apfelmus
-
Malcolm Wallace
-
Michael Orlitzky
-
Nick Knowlson
-
Stephen Tetley