Skip to content

doc(Data.List): Add some examples to Data.List

Julien Debon requested to merge Sir4ur0n/ghc:doc/addDataListDocumentation into master

Hello,

This is my very first GHC MR, please be patient with me 🙏 And I apologize in advance if I did anything wrong 😅 I've been wanting to add examples to base library for a long time to help newcomers have an easier understanding of what functions do, and today I'm finally doing it!

This MR is intentionally small, I didn't want to commit hours of documentation ahead in case I am doing something wrong.

  1. Is adding examples to each function (maybe even types) an accepted thing?
  2. Is adding examples of unsafe scenarii (e.g. head []) an accepted thing? I personally think it's best to let newcomers know when things can blow off too (and additionally, this would help them Googling error messages and landing on the documentation)

Please feel free to give me pointers at what is ok/not ok regarding documentation. If such contributions are welcome, I wouldn't mind spending more time adding documentation/examples to more functions/types.

Cheers!

NB: I did not find a way to document map in GHC.List even though it's documented in GHC.Base and imported from there, am I missing something? 🤔


Thank you for your contribution to GHC!

Please take a few moments to verify that your commits fulfill the following:

  • are either individually buildable or squashed
  • have commit messages which describe what they do (referring to Notes and tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places.
  • add a testcase to the testsuite.
  • if your MR affects library interfaces (e.g. changes base) please add the ~"user facing" label.

If you have any questions don't hesitate to open your merge request and inquire in a comment. If your patch isn't quite done yet please do add prefix your MR title with WIP:.

Merge request reports