Named version of `mapN` and friends
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- scala
調査の方向性
まず、issue にリンクされている Scala 3 の Named Tuples と Structural Types のドキュメントを読み、その後 Cats に既存する mapN API と parMapN API を探してください。issue にはファイルもテストも記載されていません。完了とするには、名前付き applicative composition のための Scala 3 API を決定し、それに対応する検証を行う必要があります。
索引モデルが issue の本文から書いたものです。
説明
I wonder if we could have a Scala 3 only version of mapN and friends that work on NamedTuples instead of plain ones.
The motivation would be to fix the major usability issue with applicative composition, where operations and the names of their results are separated.
For example, imagine a very simple for comprehension like this:
final case class Config(foo: Foo, bar: Bar, baz: Baz, quax: Quax)
object Config {
def load: IO[Config] =
for {
foo <- env(name = "FOO").as[Foo]
bar <- env(name = "BAR").as[Bar]
baz <- env(name = "BAZ").as[Baz]
quax <- env(name = "QUAX").as[Quax]
} yield Config(foo, bar, baz, quax)
}
One may realize that there is no dependency between each operation, and thus that instead of failing fast, we could try to read all env vars "concurrently" and accumulate all the errors instead:
def load: IO[Config] =
(
env(name = "FOO").as[Foo],
env(name = "BAR").as[Bar],
env(name = "BAZ").as[Baz],
env(name = "QUAX").as[Quax]
).parMapN { case (foo, bar, baz, quax) =>
Config(foo, bar, baz, quax)
}
But, this disconnects the names (foo, bar, baz, quax) from the operations that produced them; and yes, in this case, you could just do parMapN(Config.apply) but that is besides the point.
Thus, it would be great if we could use NamedTuples and maybe Structural Types to get an API like this:
def load: IO[Config] =
(
foo = env(name = "FOO").as[Foo],
bar = env(name = "BAR").as[Bar],
baz = env(name = "BAZ").as[Baz],
quax = env(name = "QUAX").as[Quax]
).namedParMapN { result =>
Config(result.foo, result.bar, result.baz, result.quax)
}
- 主要言語
- Scala
- スター
- 5.5k
- フォーク
- 1.2k
- 平均マージ
- 4日 6時間
- マージ済み PR(30日)
- 6
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
typelevel/cats のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
typelevel/sbt-typelevel#929 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
apache/pekko-projection#635 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Area: Excel support
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
orbeon/orbeon-forms#7893 ·
-
x:action/fix x:module/practice-exercise x:size/small
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100