Semigroup Result instance?
Dieses Issue hat noch niemand übernommen.
- #101 von @np — ohne Merge geschlossen
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Bereich
- testing
Rechercherichtung
Read the proposed Semigroup and Monoid instances in the issue body and the linked pull request #101 for prior discussion. Decide whether combining Result values this way fits the library’s API and supports the shown QuickCheck use case; the issue does not name implementation files or tests, so locate the existing Result definitions and instances before judging completion.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
How would we feel about the following?
instance semigroupResult :: Semigroup Result where
Success <> r = r
Failed str <> _ = Failed str
instance monoidResult :: Monoid Result where
mempty = Success
This is a use case I have in mind
log "fromRotationMatrix avoids instability issues when the quaternion has one very small component"
quickCheck \(VerySmallNum e) a b c ->
let
testWith p' =
let
p = Rotation.fromQuaternion p'
q = unsafePartial (Rotation.fromRotationMatrix (Rotation.toRotationMatrix p))
in
rApproxEq p q
<?> show { p, q }
in
fold
[ testWith (Quaternion e a b c)
, testWith (Quaternion a e b c)
, testWith (Quaternion a b e c)
, testWith (Quaternion a b c e)
]
Of course I could rewrite this test to call quickCheck four times instead, but I think the instance makes sense, and I think it would be nice to allow writing tests this way. Additionally, if generating random values for a given type is expensive, being able to combine Result values in this way could let you cut down the number of random values you need to generate, since you don't need to call quickCheck as many times.
- Vorherrschende Sprache
- PureScript
- Sterne
- 108
- Forks
- 42
- Ø Merge
- 2 T. 23 Std.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus purescript/purescript-quickcheck
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
purescript/purescript-quickcheck#136 · 1 Kommentar ·
-
Lazy List Arbitrary InstanceEvtl. vergeben @eviefp hat das vor 2207 Tagen übernommen. Offentype: enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 20/100
purescript/purescript-quickcheck#111 · 2 Kommentare · 2 Reaktionen ·
-
type: documentation
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 55/100
-
purs-0.15 type: breaking change
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
purescript/purescript-quickcheck#104 · 12 Kommentare ·
-
ShrinkingOffentype: enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
purescript/purescript-quickcheck#103 · 6 Kommentare · 4 Reaktionen ·
Alle Issues in purescript/purescript-quickcheck
Ähnliche Issues
-
[prefer-expect-resolves] autofix leaves a stray ")" when the awaited expression is parenthesizedOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
jest-community/eslint-plugin-jest#2052 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
johanhaleby/occurrent#1505 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
jeanibarz/knowledge-base-mcp-server#1262 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
future-agi/future-agi#4092 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag