You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to provide typeclass for sum type(taking into account that split method is implemented, I get following:
[error] 60 | val typeclass = summon[Default[DefaultTest]]
[error] | ^
[error] |No given instance of type contingency.Errant[wisteria.VariantError] was found
[error] |---------------------------------------------------------------------------
[error] |Inline stack trace
[error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error] |This location contains code that was inlined from wisteria.SumDerivationMethods.scala:126
[error] 126 | then raise(VariantError[DerivationType](inputLabel))(Unset)(using summonInline[Errant[VariantError]])
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I personally already figured it out, but potential adopters, for example people, who only want a replacement for magnolia for their scala3 migration might be set off by this. Would you consider removing this dependency?
The text was updated successfully, but these errors were encountered:
Everything in Soundness is "safe by default", so you need to explicitly relax the rules to avoid this, but we could find a better way to document this. You have a couple of options:
wrap the code in unsafely(...) and let exceptions be thrown
wrap the code in safely and get an Optional value in place of the error
globally import contingency.errorHandlers.throwUnsafely or .throwSafely (if you're using language.saferExceptions)
use tend/remedy, like so:
tend(...).remedy:caseVariantError(label, sum, variants) =>// handle it
The last variant will be checked for error exhaustivity.
None of this is documented yet, and Contingency is not "officially" released yet, but it's one of the most important Soundness modules. I'm part-way through writing a series of blogposts about error handling in Soundness to try to help with understanding this.
When trying to provide typeclass for sum type(taking into account that
split
method is implemented, I get following:I personally already figured it out, but potential adopters, for example people, who only want a replacement for magnolia for their scala3 migration might be set off by this. Would you consider removing this dependency?
The text was updated successfully, but these errors were encountered: