Impossible to create an instance of the Costrong class

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
領域
backend

調査の方向性

Start by reading the Costrong class and its unfirst method; the issue gives no file or test paths, so locate them in the repository. Compare the strict definition with the proposed Lazy constraint and consider the naming or library scope raised in the issue. Done means establishing whether the proposed approach is viable and agreeing on the API direction.

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

説明

The reason that Function and other types cannot be an instance of Costrong is that PureScript is a strict evaluation.

unfirst :: forall a b c. p (Tuple a c) (Tuple b c) -> p a b

That is, when we want to loop over c, it is impossible to set the initial value of c

How to modify it may be debatable, but I found the following solution

unfirstLazy :: forall a b c. Lazy c => p (Tuple a c) (Tuple b c) -> p a b
unfirstLazy f a = fst $ f $ Tuple a $ go
  where
  go = snd $ f $ Tuple a $ defer \_ -> go

Also, since this is not "Co" Strong, it might be better to name the class differently, for example CostrongLazy, or create a new library.

Thanks to natefaubion for sharing this issue on PureScript discord server.

主要言語
PureScript
スター
34
フォーク
13
平均マージ
3日 10分
マージ済み PR(30日)
1

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

purescript/purescript-profunctor のほかの issue

purescript/purescript-profunctor の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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