[Haskell-cafe] Comments from OCaml Hacker Brian Hurt

Andrei Formiga andrei.formiga at gmail.com
Thu Jan 15 12:14:27 EST 2009


On Thu, Jan 15, 2009 at 1:44 PM, Wouter Swierstra <wss at cs.nott.ac.uk> wrote:
>
> Would you call function composition (on endofunctions) "appending"? The join
> of a monad? A semi-colon (as in sequencing two imperative statements)? How
> do you append two numbers? Addition, multiplication, or something else
> entirely?
>
> All these operations are monoidal, i.e., are associative and have both left
> and right identities. If that's exactly what they have in common, why invent
> a new name? "Appendable" may carry some intuition, but it is not precise and
> sometimes quite misleading.
>

I think this highlights an interesting point: Haskell is more abstract
than most other languages. While in other languages "Appendable" might
just mean what Brian suggested in his post, "something with an empty
state and the ability to append things to the end", in Haskell it
applies to numbers and everything else that has an associative
operator, that is, everything that is a monoid. So "Appendable" for
numbers would be quite wrong; either it would never be used in
situations where one wanted to "append things to the end" (which is
limiting), or it would be used in these situations, which would be
quite confusing.

I think it is much more important to have good documentation about the
typeclasses (and everything else in the library). This issue was
mentioned recently in a discussion about monads, and the documentation
for the Haskell library is quite uninformative. It would be nice if 1)
people would not be scared of names like "monoid" and "functor" and 2)
the documentation clearly stated what these things are, in a
programming context, preferably with some examples. I think 2 would
mitigate some of the fear mentioned in 1, if newcomers started to
experience things like "hey, that's one funky-named stuff this monoid
thing, but I see here in the documentation that it is quite simple".


-- 
[]s, Andrei Formiga


More information about the Haskell-Cafe mailing list