Impossible to create an instance of the Costrong class

Offen
#46 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
PureScript
Sterne
34
Forks
13
Ø Merge
3 T. 10 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus purescript/purescript-profunctor

Alle Issues in purescript/purescript-profunctor

Ähnliche Issues

Weitere Issues zu Backend & API Design

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.