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
Could not find an implicit instance of Raise[Main.MyState, String]. If you have
a good way of handling errors of typeString at this location, you may want
to construct a value of typeEitherTforthis call-site, rather than Main.MyState.
An example type:EitherT[Main.MyState, String, *]
This is analogous to writing try/catch around this call. TheEitherT will
"catch" the errors of typeString.
If you do not wish to handle errors of typeString at this location, you should
add an implicit parameter of thistypeto your function. Forexample:
(implicitfraise: Raise[Main.MyState, String])
Manually defining the missing Raise instance using def raise(e) = StateT.liftF(EitherT.leftT(e)) makes it work.
The text was updated successfully, but these errors were encountered:
Just traversing this repo and found your issue here. Intrigued me somehow so I checked it. While looking at your github I am pretty sure you know the fix, however let me post here my findings:
If you change Raise to Handle your code will work. Handle extends Raise but it is somehow not being resolved here for the StateT (maybe it's a compiler bug?)
so the patch is simple (?) and is about creating a Raise provider for StateT based on Handler.handleStateT function:
Cats-MTL v0.7.1 allows both arrangements.
Cats-MTL v1.1.1 case works only when EitherT is on the top.
Using: cats-mtl v0.7.1
https://scastie.scala-lang.org/vIEWTZkrTlGyel2jBiwRoA
Using: cats-mtl v1.1.1
https://scastie.scala-lang.org/bZE05pflSnKOjpPiGmksjg
Compiler output
Manually defining the missing
Raise
instance usingdef raise(e) = StateT.liftF(EitherT.leftT(e))
makes it work.The text was updated successfully, but these errors were encountered: