[Haskell-cafe] Restricted type classes

David Menendez dave at zednenem.com
Sat Sep 4 13:34:28 EDT 2010

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?

Dave Menendez <dave at zednenem.com>

More information about the Haskell-Cafe mailing list