mapM_ for bytestring

Henning Thielemann lemming at henning-thielemann.de
Wed Sep 11 20:25:50 CEST 2013


On Wed, 11 Sep 2013, Duncan Coutts wrote:

> For mapM etc, personally I think a better solution would be if
> ByteString and Text and other specialised containers could be an
> instance of Foldable/Traversable. Those classes define mapM etc but
> currently they only work for containers that are polymorphic in their
> elements, so all specialised containers are excluded. I'm sure there
> must be a solution to that (I'd guess with type families) and that would
> be much nicer than adding mapM etc to bytestring itself. We would then
> just provide efficient instances for Foldable/Traversable.

I'd prefer to keep bytestring simple with respect to the number of type 
extensions. Since you must implement ByteString.mapM anyway, you can plug 
this into an instance definition of Traversable ByteString.



More information about the Libraries mailing list