[Haskell-cafe] Instances for Set of Functor, Traversable?

Henning Thielemann lemming at henning-thielemann.de
Mon Jul 26 18:05:02 EDT 2010


On Mon, 26 Jul 2010, Gregory Crosswhite wrote:

> Is there a specific reason why Set doesn't have instances for Functor
> and Traversable?

Sure, fmap needs an Ord restriction for the element type, which is not 
possible for the plain Functor constructor class. E.g. in
    fmap (const 'a') set
  all result elements will coincide. If you need such an fmap, try
   http://hackage.haskell.org/package/rmonad .


More information about the Haskell-Cafe mailing list