dusty-phillips / rescript-zora

Lightning-fast testing for a lightning-fast compiler
MIT License
52 stars 11 forks source link

Why does `requireError` not have a `check` parameter? #11

Closed brettcannon closed 6 months ago

brettcannon commented 6 months ago

https://github.com/dusty-phillips/rescript-zora/blob/19c5c7c39f276e68b63c9ffd398f931b43e9b4fc/src/Zora.res#L41

Compare that to requireOk: https://github.com/dusty-phillips/rescript-zora/blob/19c5c7c39f276e68b63c9ffd398f931b43e9b4fc/src/Zora.res#L47

Since Error can have a value, would it make sense for requireError to also take a check function (and thus drop the ~msg parameter)?

dusty-phillips commented 6 months ago

My best guess is that some past version of me lived in a universe where things always failed in the exact same way?

brettcannon commented 6 months ago

@dusty-phillips would you want a PR that requires a check function, or makes it optional?

dusty-phillips commented 6 months ago

Yup! I’ll try to pop a release out after, too.

brettcannon commented 6 months ago

@dusty-phillips was that a "yup" to option 1, option 2, or dealer's choice? And if it's option 2, would you want option* and requireOk to be updated accordingly? And if it's option 1 do you want some no-op function or some other solution that provides a message (and updating the other related functions accordingly)?

dusty-phillips commented 6 months ago

Sorry! I think it should be optional and make the others consistent, but I could go either way.