Time to add the Traversable laws to the Documentation
roconnor at theorem.ca
roconnor at theorem.ca
Fri Aug 24 03:53:30 CEST 2012
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.
> I guess you're assuming that the naturality property, i.e.
>
> (3) traverse (t . f) = t . traverse f
>
> for any Applicative transformation t, is automatic. Even so it would
> be useful to state it.
Yes, I understand from Voigtlander's "Free theorems involving type
constructor classes: functional pearl" that for fast and loose reasoning
it is automatic. I agree that it would be good to state.
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".
--
Russell O'Connor <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
More information about the Libraries
mailing list