Add references between Data.Traversable.for and Data.Foldable.for_ and co.
ClosedPublic

Authored by Iceland_jack on Nov 13 2014, 1:56 PM.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Iceland_jack retitled this revision from to Add references between Data.Traversable.for and Data.Foldable.for_ and co..
Iceland_jack updated this object.
Iceland_jack edited the test plan for this revision. (Show Details)
Iceland_jack added a reviewer: austin.
Iceland_jack added a project: GHC.
dfeuer accepted this revision.Nov 13 2014, 2:50 PM
dfeuer edited edge metadata.

I think this is a great idea, unless you want to propose re-exporting Data.Foldable from Data.Traversable.

This revision is now accepted and ready to land.Nov 13 2014, 2:50 PM
dfeuer requested changes to this revision.Nov 13 2014, 2:51 PM
dfeuer edited edge metadata.

Actually, one change: I don't think contractions like "doesn't" belong in public documentation.

This revision now requires changes to proceed.Nov 13 2014, 2:51 PM
Iceland_jack edited edge metadata.

doesn't ↦ does not

Iceland_jack added a comment.EditedNov 13 2014, 4:45 PM

The documentation says something akin to “Evaluate each monadic action in the structure from left to right, and ignore the results.” and I copied that, should “discard the result” be used instead?

Edit: Or “discarding the result”.

ekmett edited edge metadata.Nov 14 2014, 11:46 AM

I think this is a great idea, unless you want to propose re-exporting Data.Foldable from Data.Traversable.

That would break an incredibly large amount of code. Please, God, no.

Every re-export means someone somewhere winds up having to hide 2 dozen hiding clauses in a module somewhere twice or switch their code to qualified imports.

I've been meaning to fix the fact that all the modules in mtl re-export Control.Monad and therefore bring into scope all sorts of names. It is great fun when you don't want one of those names to be imported, and you are working with several transformers (e.g. to provide instances) because now you wind up hiding it from 6 modules. =/

ekmett accepted this revision.Nov 14 2014, 11:46 AM
ekmett edited edge metadata.

LGTM.

ekmett added inline comments.Nov 14 2014, 11:48 AM
libraries/base/Data/Foldable.hs
228

Would it make sense to use the haddock example syntax?

>>> for_ [1..4] print
1
2
3
4

?

Iceland_jack updated this object.
Iceland_jack edited edge metadata.
Iceland_jack added inline comments.Nov 14 2014, 12:35 PM
libraries/base/Data/Foldable.hs
228

It would. Should more examples be added? Both modules are light on examples that aren't laws or instance declarations.

Mikolaj accepted this revision.Nov 18 2014, 5:16 AM
Mikolaj edited edge metadata.

LGTM. Personally I don't see a need for more examples at least for the elementary operations from the patch. It's their generality, the type machinery behind them that is interesting and non-trivial, not their behaviour.

austin accepted this revision.Nov 19 2014, 8:09 AM
austin edited edge metadata.

LGTM.

hvr added a subscriber: mjo.Nov 19 2014, 8:53 AM
hvr added inline comments.
libraries/base/Data/Foldable.hs
228

@Iceland_jack, If you decide to add more examples, please follow the markup style used in @mjo's recent example-adding work (see e.g. d14312fcb4c7d3c2a35e086acdac6127ff1a4c60 )

I tried to land the patch, but it doesn't seem to apply cleanly to the current master. When you are done extending it, if you plan to any more, could you rebase it, too? Thank you.

This revision was automatically updated to reflect the committed changes.