atnos-org / eff

Eff monad for cats - https://atnos-org.github.io/eff
MIT License
579 stars 78 forks source link

"Composing ADTs" tutorial code does not work as expected #343

Open matthew-healy opened 3 years ago

matthew-healy commented 3 years ago

Hi folks,

I started following the eff tutorial earlier today. When I reached the section on Composing ADTs with the Eff monad I found that I was completely unable to get the code to run in the way the documentation suggests it should.

You can find my attempt on Scastie here. I've checked my code multiple times and I can't find any differences to the code in the tutorial. However, as far as I can tell, only the first line of the for-comprehension in program is ever "run".

E.g. if I modify program to instead read:

def program[R :_interact :_dataOp]: Eff[R, Unit] =
  for {
    _ <- tellUser("hello")
    _ <- tellUser("goodbye")
  } yield ()

only hello is printed to the console.

Apologies if a GH issue isn't the right place to raise this, but I've been banging my head against it for a while and have absolutely no idea what (if anything) I've done wrong. Any help would be much appreciated (as would pointers on a better place to ask this question, if appropriate πŸ˜„ ).

Thanks!

benhutchison commented 3 years ago

Hi Matthew,

The reality is that Eff has few active users and you'll probably need to debug things for yourself to make progress with the library.

It was built by Eric Torreborre but he has since moved mainly to haskell.

I've switched from Eff to cats MTL myself, or even simpler, tagless final when that will suffice. A key reason was to reduce the internal complexity of my projects. Have you considered MTL?

On Sat., 27 Feb. 2021, 5:33 am Matthew Healy, notifications@github.com wrote:

Hi folks,

I started following the eff tutorial earlier today. When I reached the section on Composing ADTs with the Eff monad https://atnos-org.github.io/eff/org.atnos.site.Tutorial.html#composing-adts-with-the-eff-monad I found that I was completely unable to get the code to run in the way the documentation suggests it should.

You can find my attempt on Scastie here https://scastie.scala-lang.org/matthew-healy/xMnf4728QO29mc8pHueJyA/22. I've checked my code multiple times and I can't find any differences to the code in the tutorial. However, as far as I can tell, only the first line of the for-comprehension in program is ever "run".

E.g. if I modify program to instead read:

def program[R :_interact :_dataOp]: Eff[R, Unit] =

for {

_ <- tellUser("hello")

_ <- tellUser("goodbye")

} yield ()

only hello is printed to the console.

Apologies if a GH issue isn't the right place to raise this, but I've been banging my head against it for a while and have absolutely no idea what (if anything) I've done wrong. Any help would be much appreciated (as would pointers on a better place to ask this question, if appropriate πŸ˜„ ).

Thanks!

β€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/atnos-org/eff/issues/343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXJZCU3INMISD23KFK5YTTA7SQ3ANCNFSM4YI5DMZQ .

matthew-healy commented 3 years ago

Hey Ben - that's totally fair, thanks for letting me know! I'll take a look at cats MTL instead. 😁