Open newhoggy opened 3 months ago
In the current state, I am neutral:
reader
context is nice to have, but not essential.One advantage is that you could log in the functions being tested and then capture those logs in a test annotation like this:
┏━━ test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs ━━━
38 ┃ hprop_deserialise_nonLegacy_signing_Key :: Property
39 ┃ hprop_deserialise_nonLegacy_signing_Key = propertyOnce $ localWorkspace $ do
40 ┃ skeyBs <- LBS.readFile "test/cardano-cli-golden/files/input/byron/keys/byron.skey1"
┃ │ [info] [T.G.B.SigningKeys#40] Reading bytestring from file: test/cardano-cli-golden/files/input/byron/keys/byron.skey1
41 ┃ & trapFail @IOException
┃ ^^^^^^^^^^^^^^^^^^^^^^^
┃ │ Expected Right: test/cardano-cli-golden/files/input/byron/keys/byron.skey1: openBinaryFile: does not exist (No such file or directory)
42 ┃
43 ┃ fromEither (deserialiseFromBytes Crypto.fromCBORXPrv skeyBs)
44 ┃ & trapFail @DeserialiseFailure
45 ┃ & void
The line:
┃ │ [info] [T.G.B.SigningKeys#40] Reading bytestring from file: test/cardano-cli-golden/files/input/byron/keys/byron.skey1
Is logging from the readFile
function, which is pretty short but we could have logging in a more elaborate function and when we get a failure that logging could give some insight into what the function we are testing isn't behaving as expected.
so I'm wondering why polysemy and not some other effect system?
Mainly due to familiarity and ecosystem - in particular the logging library polysemy-log
. We could select a different effect system but we may need to implement the libraries we want and we should also apart from performance evaluate how good the errors are.
All in all, I'm not convinced:
If we are convinced this is important, I would wait a few months to see if this part of the ecosystem gains traction.
This PR is stale because it has been open 45 days with no activity.
Changelog
Context
Using
polysemy
to simplify tests.How to trust this PR
Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.
Checklist