[Haskell-cafe] The container problem

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Sep 27 12:29:00 EDT 2008

On 2008 Sep 27, at 9:24, Andrew Coppin wrote:
> David Menendez wrote:
>> I wouldn't say that. It's important to remember that Haskell class
>> Monad does not, and can not, represent *all* monads, only (strong)
>> monads built on a functor from the category of Haskell types and
>> functions to itself.
>> Data.Set is a functor from the category of Haskell types *with
>> decidable ordering* and *order-preserving* functions to itself.  
>> That's
>> not the same category, although it is closely related.
> I nominate this post for the September 2008 Most Incomprehensible  
> Cafe Post award! :-D
> Seriously, that sounded like gibberish. (But then, you're talking to  
> somebody who can't figure out the difference between a set and a  
> class, so...)

That response required a certain amount of category theory to grok.

When you have a typeclass, the constraints (that is, the (Foo a =>)  
contexts) on it are the exact constraints on members of the class.   
You can't add more or leave some out.

Set and Map both require an additional constraint over those of  
Functor and Monad:  (Ord a =>).  Since you can't add constraints on  
top of a typeclass, you can't make them members of Functor or Monad.   
(Unless you use some Oleg-style hackery.)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list