[Haskell-cafe] Restricted type classes

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sun Sep 5 01:06:39 EDT 2010


On 5 September 2010 03:34, David Menendez <dave at zednenem.com> wrote:
> On Fri, Sep 3, 2010 at 8:23 AM, John Lato <jwlato at gmail.com> wrote:
>> Do you have a kind * implementation of Foldable?  I'd be interested in
>> seeing it, because I was unable to create a usable implementation (based
>> upon the RMonad scheme) on my last attempt.
>
> I always figured it would look something like:
>
> class Foldable f where
>  type Elem f :: *
>  foldMap :: Monoid m => (Elem f -> m) -> f -> m
>
> with the usual definitions for foldr, foldl, etc.
>
>> +1 for using the proper constraints, and especially for bringing over
>> Pointed (and anything else that applies).
>
> What's the argument for Pointed? Are there many types which are
> instances of Pointed but not Applicative? Are there many algorithms
> which require Pointed but not Applicative?

Presumably just that it's another possible abstraction.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list