List[EitherT[Future, String, CustomObj]] => EitherT[Future, String, List[CustomObj]]












0















How to use sequence function for List[EitherT[Future, String, CustomObj]] with custom class CustomObj ? I want something like that :



import scala.language.postfixOps
import cats.instances.list._
import cats.syntax.traverse._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Every time during compile I get



 error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A].


What does it mean <:< G[A] ?










share|improve this question

























  • @erip A note on sequencing

    – Yaneeve
    Nov 20 '18 at 15:22













  • What do you mean it "doesn't work"?

    – erip
    Nov 20 '18 at 15:45











  • I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:33











  • You should create a minimal example that we can copy and paste. I can't debug this without more info.

    – erip
    Nov 20 '18 at 17:35






  • 1





    scalacOptions += "-Ypartial-unification" . Just add it to build.sbt or pom.xml if you use maven. This does the trick. Now everything works fine. Thanks for your comments.

    – Dex
    Nov 21 '18 at 10:07
















0















How to use sequence function for List[EitherT[Future, String, CustomObj]] with custom class CustomObj ? I want something like that :



import scala.language.postfixOps
import cats.instances.list._
import cats.syntax.traverse._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Every time during compile I get



 error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A].


What does it mean <:< G[A] ?










share|improve this question

























  • @erip A note on sequencing

    – Yaneeve
    Nov 20 '18 at 15:22













  • What do you mean it "doesn't work"?

    – erip
    Nov 20 '18 at 15:45











  • I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:33











  • You should create a minimal example that we can copy and paste. I can't debug this without more info.

    – erip
    Nov 20 '18 at 17:35






  • 1





    scalacOptions += "-Ypartial-unification" . Just add it to build.sbt or pom.xml if you use maven. This does the trick. Now everything works fine. Thanks for your comments.

    – Dex
    Nov 21 '18 at 10:07














0












0








0








How to use sequence function for List[EitherT[Future, String, CustomObj]] with custom class CustomObj ? I want something like that :



import scala.language.postfixOps
import cats.instances.list._
import cats.syntax.traverse._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Every time during compile I get



 error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A].


What does it mean <:< G[A] ?










share|improve this question
















How to use sequence function for List[EitherT[Future, String, CustomObj]] with custom class CustomObj ? I want something like that :



import scala.language.postfixOps
import cats.instances.list._
import cats.syntax.traverse._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Every time during compile I get



 error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A].


What does it mean <:< G[A] ?







scala scala-cats either






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 9:46







Dex

















asked Nov 20 '18 at 14:49









DexDex

82




82













  • @erip A note on sequencing

    – Yaneeve
    Nov 20 '18 at 15:22













  • What do you mean it "doesn't work"?

    – erip
    Nov 20 '18 at 15:45











  • I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:33











  • You should create a minimal example that we can copy and paste. I can't debug this without more info.

    – erip
    Nov 20 '18 at 17:35






  • 1





    scalacOptions += "-Ypartial-unification" . Just add it to build.sbt or pom.xml if you use maven. This does the trick. Now everything works fine. Thanks for your comments.

    – Dex
    Nov 21 '18 at 10:07



















  • @erip A note on sequencing

    – Yaneeve
    Nov 20 '18 at 15:22













  • What do you mean it "doesn't work"?

    – erip
    Nov 20 '18 at 15:45











  • I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:33











  • You should create a minimal example that we can copy and paste. I can't debug this without more info.

    – erip
    Nov 20 '18 at 17:35






  • 1





    scalacOptions += "-Ypartial-unification" . Just add it to build.sbt or pom.xml if you use maven. This does the trick. Now everything works fine. Thanks for your comments.

    – Dex
    Nov 21 '18 at 10:07

















@erip A note on sequencing

– Yaneeve
Nov 20 '18 at 15:22







@erip A note on sequencing

– Yaneeve
Nov 20 '18 at 15:22















What do you mean it "doesn't work"?

– erip
Nov 20 '18 at 15:45





What do you mean it "doesn't work"?

– erip
Nov 20 '18 at 15:45













I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

– Dex
Nov 20 '18 at 16:33





I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

– Dex
Nov 20 '18 at 16:33













You should create a minimal example that we can copy and paste. I can't debug this without more info.

– erip
Nov 20 '18 at 17:35





You should create a minimal example that we can copy and paste. I can't debug this without more info.

– erip
Nov 20 '18 at 17:35




1




1





scalacOptions += "-Ypartial-unification" . Just add it to build.sbt or pom.xml if you use maven. This does the trick. Now everything works fine. Thanks for your comments.

– Dex
Nov 21 '18 at 10:07





scalacOptions += "-Ypartial-unification" . Just add it to build.sbt or pom.xml if you use maven. This does the trick. Now everything works fine. Thanks for your comments.

– Dex
Nov 21 '18 at 10:07












1 Answer
1






active

oldest

votes


















0














This is an edited version, code @ https://scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A:



import scala.language.postfixOps
import cats.implicits._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Initially I wrote:




Notice please that it didn't compile and produced odd compile messages
until I added import
scala.concurrent.ExecutionContext.Implicits.global




And that holds true, BUT your trouble did not lie there. When I went to reproduce again, I got the error you had specified. The thing that was missing is an SBT/scalac flag: scalacOptions += "-Ypartial-unification"






share|improve this answer


























  • Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:31











  • What are SomeType1 SomeType2? They are not in your question

    – Yaneeve
    Nov 20 '18 at 16:42











  • it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

    – Dex
    Nov 20 '18 at 16:54













  • scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

    – Yaneeve
    Nov 20 '18 at 21:45











  • I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

    – Dex
    Nov 21 '18 at 9:47











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395581%2flisteithertfuture-string-customobj-eithertfuture-string-listcustomo%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














This is an edited version, code @ https://scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A:



import scala.language.postfixOps
import cats.implicits._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Initially I wrote:




Notice please that it didn't compile and produced odd compile messages
until I added import
scala.concurrent.ExecutionContext.Implicits.global




And that holds true, BUT your trouble did not lie there. When I went to reproduce again, I got the error you had specified. The thing that was missing is an SBT/scalac flag: scalacOptions += "-Ypartial-unification"






share|improve this answer


























  • Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:31











  • What are SomeType1 SomeType2? They are not in your question

    – Yaneeve
    Nov 20 '18 at 16:42











  • it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

    – Dex
    Nov 20 '18 at 16:54













  • scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

    – Yaneeve
    Nov 20 '18 at 21:45











  • I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

    – Dex
    Nov 21 '18 at 9:47
















0














This is an edited version, code @ https://scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A:



import scala.language.postfixOps
import cats.implicits._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Initially I wrote:




Notice please that it didn't compile and produced odd compile messages
until I added import
scala.concurrent.ExecutionContext.Implicits.global




And that holds true, BUT your trouble did not lie there. When I went to reproduce again, I got the error you had specified. The thing that was missing is an SBT/scalac flag: scalacOptions += "-Ypartial-unification"






share|improve this answer


























  • Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:31











  • What are SomeType1 SomeType2? They are not in your question

    – Yaneeve
    Nov 20 '18 at 16:42











  • it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

    – Dex
    Nov 20 '18 at 16:54













  • scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

    – Yaneeve
    Nov 20 '18 at 21:45











  • I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

    – Dex
    Nov 21 '18 at 9:47














0












0








0







This is an edited version, code @ https://scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A:



import scala.language.postfixOps
import cats.implicits._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Initially I wrote:




Notice please that it didn't compile and produced odd compile messages
until I added import
scala.concurrent.ExecutionContext.Implicits.global




And that holds true, BUT your trouble did not lie there. When I went to reproduce again, I got the error you had specified. The thing that was missing is an SBT/scalac flag: scalacOptions += "-Ypartial-unification"






share|improve this answer















This is an edited version, code @ https://scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A:



import scala.language.postfixOps
import cats.implicits._
import cats.data.EitherT
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

case class CustomObj(int: Int)

private val fst: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(1))
private val snd: EitherT[Future, String, CustomObj] =
EitherT.pure[Future, String](CustomObj(2))

val source: List[EitherT[Future, String, CustomObj]] = fst :: snd :: Nil

val result: EitherT[Future, String, List[CustomObj]] = source.sequence

import scala.concurrent.duration._
val res = scala.concurrent.Await.result(result.value, 1 second)
println(res) // Right(List(CustomObj(1), CustomObj(2)))


Initially I wrote:




Notice please that it didn't compile and produced odd compile messages
until I added import
scala.concurrent.ExecutionContext.Implicits.global




And that holds true, BUT your trouble did not lie there. When I went to reproduce again, I got the error you had specified. The thing that was missing is an SBT/scalac flag: scalacOptions += "-Ypartial-unification"







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 20 '18 at 21:49

























answered Nov 20 '18 at 15:18









YaneeveYaneeve

2,75083882




2,75083882













  • Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:31











  • What are SomeType1 SomeType2? They are not in your question

    – Yaneeve
    Nov 20 '18 at 16:42











  • it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

    – Dex
    Nov 20 '18 at 16:54













  • scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

    – Yaneeve
    Nov 20 '18 at 21:45











  • I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

    – Dex
    Nov 21 '18 at 9:47



















  • Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

    – Dex
    Nov 20 '18 at 16:31











  • What are SomeType1 SomeType2? They are not in your question

    – Yaneeve
    Nov 20 '18 at 16:42











  • it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

    – Dex
    Nov 20 '18 at 16:54













  • scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

    – Yaneeve
    Nov 20 '18 at 21:45











  • I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

    – Dex
    Nov 21 '18 at 9:47

















Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

– Dex
Nov 20 '18 at 16:31





Thanks a lot .. but I get : error: Cannot prove that cats.data.EitherT[Future, SomeType1, SomeType2] <:< G[A]. Actually I can't understand why it happens..

– Dex
Nov 20 '18 at 16:31













What are SomeType1 SomeType2? They are not in your question

– Yaneeve
Nov 20 '18 at 16:42





What are SomeType1 SomeType2? They are not in your question

– Yaneeve
Nov 20 '18 at 16:42













it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

– Dex
Nov 20 '18 at 16:54







it doesn't matter.. let it be : EitherT[Future, String, CustomObj] The error is: Cannot prove that cats.data.EitherT[Future, String, CustomObj] <:< G[A].

– Dex
Nov 20 '18 at 16:54















scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

– Yaneeve
Nov 20 '18 at 21:45





scastie.scala-lang.org/Yaneeve/Jro89ZHwS3G23Aveanxc5A - I have reworked it here slightly an I will amend my answer accordingly

– Yaneeve
Nov 20 '18 at 21:45













I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

– Dex
Nov 21 '18 at 9:47





I still get error: Cannot prove that EitherT[Future,String,CustomObj] <:< G[A]. What does it mean <:< G[A]. ?

– Dex
Nov 21 '18 at 9:47


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395581%2flisteithertfuture-string-customobj-eithertfuture-string-listcustomo%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

WPF add header to Image with URL pettitions [duplicate]