Time to add the Traversable laws to the Documentation

Ross Paterson ross at soi.city.ac.uk
Sat Aug 25 12:47:34 CEST 2012


On Fri, Aug 24, 2012 at 02:53:30AM +0100, roconnor at theorem.ca wrote:
> On Fri, 24 Aug 2012, Ross Paterson wrote:
> 
> > On Fri, Aug 24, 2012 at 12:08:04AM +0100, roconnor at theorem.ca wrote:
> >> With such wide spread agreement going back at least 6 years, I think it is
> >> time to add the following 2 laws to the documentation for
> >> Data.Traversable.Traversable.
> >>
> >> (1) traverse Identity == Identity
> >> (2) traverse (Compose . fmap g . f) == Compose . fmap (traverse g) . traverse f
> >
> > Sounds good (except that Identity and Compose aren't defined in base).
> 
> Er right.  I'm not entirely sure how to address this issue.

There doesn't seem to be any alternative to re-iterating the newtype
definitions and the Functor and Applicative instances in the doc comment.

> If you want to follow the terminology from "Essence of the Iterator 
> Pattern" of using "idiomatic" for adjectives, you would call t an 
> "Idiomatic transformation".

Noooo, please don't do that.  The transformations should match the
functors, and the adjective "applicative" at least has a grain of
relevant meaning.



More information about the Libraries mailing list