[Haskell-cafe] The container problem

Andrew Coppin andrewcoppin at btinternet.com
Sat Sep 27 12:41:32 EDT 2008


Brandon S. Allbery KF8NH wrote:
> On 2008 Sep 27, at 9:24, Andrew Coppin wrote:
>> 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.

No kidding. ;-)

> 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.)

Yes. This I understand. And ByteString constrains the element type to 
just Word8. Or Char, depending which one you use. And in principle other 
containers might exist with other constraints. (E.g., hashtables require 
hash functions.)

I'm not sure how that qualifies set as "not really a true monad anyway" 
- but then, I don't know what a monad is, originally. I only know what 
it means in Haskell.

Also... Who or what is an Oleg, and why do I keep hearing about it? ;-)



More information about the Haskell-Cafe mailing list