Semigroup Result instance?
Nessuno ha ancora preso questa issue.
- #101 di @np — chiusa senza merge
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- testing
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- PureScript
- Stelle
- 108
- Fork
- 42
- Merge medio
- 2g 23h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di purescript/purescript-quickcheck
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
purescript/purescript-quickcheck#136 · 1 commento ·
-
Lazy List Arbitrary InstanceForse già presa @eviefp l’ha presa 2206 giorni fa. Apertatype: enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
purescript/purescript-quickcheck#111 · 2 commenti · 2 reazioni ·
-
type: documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 55/100
-
purs-0.15 type: breaking change
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
purescript/purescript-quickcheck#104 · 12 commenti ·
-
ShrinkingApertatype: enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
purescript/purescript-quickcheck#103 · 6 commenti · 4 reazioni ·
Tutte le issue di purescript/purescript-quickcheck
Issue simili
-
[prefer-expect-resolves] autofix leaves a stray ")" when the awaited expression is parenthesizedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jest-community/eslint-plugin-jest#2052 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
johanhaleby/occurrent#1505 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
jeanibarz/knowledge-base-mcp-server#1262 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
future-agi/future-agi#4092 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno