[Haskell-cafe] Comments from OCaml Hacker Brian Hurt

Ross Mellgren rmm-haskell at z.odi.ac
Thu Jan 15 13:49:41 EST 2009


On Jan 15, 2009, at 1:21 PM, David Menendez wrote:
> On Thu, Jan 15, 2009 at 11:46 AM, Ross Mellgren <rmm- 
> haskell at z.odi.ac> wrote:
>> Second is that there appears to be no way to document an  
>> _instance_. It
>> would be really handy if there were even a single line under  
>> "Instances >
>> Monoid ([] a)" that explained how the type class was implemented  
>> for the
>> list type. As it is, if you know what a Monoid is already, it's  
>> easy to
>> figure out how it would be implemented.
>
> Not necessarily. Any instance of MonadPlus (or Alternative) has at
> least two reasonable Monoid instances: (mplus, mzero) and (liftM2
> mappend, return mempty). [] uses the first and Maybe uses the second.

Sorry my brain apparently misfired writing the original email. What I  
meant to say is that for the Monoid instance on [a] it's fairly easy  
(knowing what a Monoid is) to figure out how it's implemented, but  
that's not true for other classes or instances.

That is to say, I agree with you, and intended to up front ;-)

-Ross



More information about the Haskell-Cafe mailing list