Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad parsing #12

Open
nafg opened this issue Jul 31, 2023 · 4 comments
Open

Bad parsing #12

nafg opened this issue Jul 31, 2023 · 4 comments

Comments

@nafg
Copy link

nafg commented Jul 31, 2023


  ZIO Type Mismatch  

Your effect requires the following environment, but it was not provided:

❯ grist.GristClient

Your effect has an error type mismatch:

❯ Required: twilio.CallTree.Failure
❯ Found   : Either[String

Your effect has a return type mismatch:

❯ Required: twilio.CallTree[R
❯ Found   : Throwable

--------------------------------------------------------------------------------
type mismatch;
 found   : kupasyomtov.igudbneitorah.Main.MainMenuOptions.Value => zio.ZIO[grist.GristClient with twilio.CallInfo,Either[String,Throwable],twilio.CallTree.Gather[Nothing]]
 required: kupasyomtov.igudbneitorah.Main.MainMenuOptions.Value => zio.ZIO[twilio.CallInfo with R,twilio.CallTree.Failure,twilio.CallTree[R]]
    (which expands to)  kupasyomtov.igudbneitorah.Main.MainMenuOptions.Value => zio.ZIO[twilio.CallInfo with R,scala.util.Either[String,Throwable],twilio.CallTree[R]]

 [29:62]
@hmemcpy
Copy link
Owner

hmemcpy commented Jul 31, 2023

Ugh, thanks! It's all nasty regex on the inside, I'll try tweaking it!

@nafg
Copy link
Author

nafg commented Jul 31, 2023

Why not use a parsing library?

@hmemcpy
Copy link
Owner

hmemcpy commented Jul 31, 2023

It all started as a hack (you can watch my interview with Adam here). I am open to consider a parsing library, I will have to bundle it with the plugin to match the compiler versions probably...

@nafg
Copy link
Author

nafg commented Jul 31, 2023

Oh yeah that's always the tricky thing about compiler plugins. Otherwise I would imagine the obvious choice would be the zio parsing library...

Anyway I'm no expert but I'd imagine the next best way to deal with bracket pairs is recursive functions (hand parsing).

I assume you're know you're looking at a ZIO and you don't care to subdivide each of the 3 arguments, you just want to correctly find the end. So I guess you could go through the string counting brackets.

It shouldn't be too hard but a minimal test suite will help focus it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants