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

XorT example #7

Closed
pavlosgi opened this issue Apr 21, 2016 · 8 comments
Closed

XorT example #7

pavlosgi opened this issue Apr 21, 2016 · 8 comments

Comments

@pavlosgi
Copy link
Contributor

pavlosgi commented Apr 21, 2016

I am trying to do

XorT.pure(eff)

where

eff: Eff[SomeEffect, Validated[E, A]]

and I get the following errors:

[error]  both value listInstance in trait ListInstances of type => cats.Traverse[List] with cats.MonadCombine[List] with cats.CoflatMap[List]
[error]  and value optionInstance in trait OptionInstances of type => cats.Traverse[Option] with cats.MonadCombine[Option] with cats.CoflatMap[Option] with cats.Alternative[Option]
[error]  match expected type cats.Applicative[F]
[error]     XorT.pure(s)

This is very weird since my Eff type has nothing to do with Option nor List. Weirdly if I do this:

XorT.pure(s)(optionInstance)

it compiles

@etorreborre
Copy link
Member

Can you post a full gist with all your imports?

The other question is: what are you trying to achieve by mixing Eff and monad transformers?

@pavlosgi
Copy link
Contributor Author

I'd like to use for comprehension with Eff and Xor

@pavlosgi
Copy link
Contributor Author

I created this Gist where I am trying to do sequence to a List of effects and get the same error

[error]  both value function0Instance in trait Function0Instances of type => cats.Bimonad[Function0]
[error]  and value optionInstance in trait OptionInstances of type => cats.Traverse[Option] with cats.MonadCombine[Option] with cats.CoflatMap[Option] with cats.Alternative[Option]
[error]  match expected type cats.Applicative[G]
[error]   val efs = list.sequence

@pavlosgi
Copy link
Contributor Author

I also created this Gist where I am trying to use XorT with Eff

@etorreborre
Copy link
Member

This compiled for me with

import cats.std.list._
val efs = list.sequenceU

@pavlosgi
Copy link
Contributor Author

Should have tried that, wasn't aware that cats also provides sequenceU like scalaz does. Yep that works for me as well and also list.traverseU(identity). Any ideas on XorT ? Thanks a lot btw

@etorreborre
Copy link
Member

If you write XorT.pure(efs) just after val efs = list.sequenceU everything compiles ok.

@etorreborre
Copy link
Member

I am closing this for now. Please feel free to discuss again on gitter.

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