Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Traverse Lens Documentation Needs more Examples

オープン
#533 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
fsharp
領域
documentation

調査の方向性

まず issue で参照されている lens のドキュメントと単体テストを確認し、提供されている F# のタプル例を最小の再現として使います。型付きの List.traverse と多相の traverse を示す例をドキュメント化し、items が traverse のエイリアスであることを説明します。完了条件は、ドキュメントと例示的なテストによって、Record または Tuple モデルにおける違いが明確になることです。

索引モデルが issue の本文から書いたものです。

説明

Description

The documentation around using a lens to update a collection type within a Record or other data structure could be clearer.

Repro steps
  1. Install FSharpPlus and try to run the code below:
#r "nuget: FSharpPlus"

open FSharpPlus
open FSharpPlus.Lens
open FSharpPlus.Data

let data = (1, ["a";"b";"c"])
// Simple working example
let result1 = over (_2 << List.traverse) String.toUpper data
// The first thing one might try based on the documentation only to be greeted with
// mystifying compiler error
let result2 = over (_2 << traverse) String.toUpper data
Expected behavior

Documentation should remind the user that when trying to use items or traverse as part of a lens function composition, they should reference the typed version of traverse that matches their data structure. It would also be helpful to note that items is just an alias of traverse.

Actual behavior

All documentation examples use the polymorphic traverse function. Even the unit tests barely provide a decent example since the one example use of traverse is with nested lists in lists. I would image that most real world use of traverse would involve a Record or Tuple as the top level Model object (good old Elmish) and if one is just skimming through the tests trying to learn about lenses, they might not make the connection.

Known workarounds

Bang your head against the compiler until you gain insight.

Related information
  • Windows 10 / WSL Ubuntiu
  • .CoreCLR 6.0
Next Steps

I do not mind creating a PR to update the docs and add some more tests that are basically just examples more so than anything that covers a special corner case. Just let me know if the team is interested in making the changes and I will do the work.

主要言語
F#
スター
941
フォーク
106
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fsprojects/FSharpPlus のほかの issue

fsprojects/FSharpPlus の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。