Last active
August 6, 2016 13:09
-
-
Save pvillega/482684135f8107ed537f5540a68df8bb to your computer and use it in GitHub Desktop.
Freek issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample of code | |
// Trades Api | |
case object IsApiUp extends DSL[Xor[ErrorMessage, Ok]] | |
final case class Buy(venue: Sring, account: String, order: Order) extends DSL[Xor[ErrorMessage, NewOrderResponse]] | |
final case class VenueStocks(venue: String) extends DSL[Xor[ErrorMessage, List[Stock]]] | |
// Program | |
type API = LogApi.PRG :||: TradeApi.PRG | |
val API = Program[API] | |
type O = Xor[ErrorMessage, ?] :&: List :&: Bulb | |
def testing(venue: String, account: String, order: Order) = for { | |
_ <- isVenueUp(venue).freeko[API, O] | |
l <- venueStocks(venue).freeko[API, O] | |
b <- buy(venue, account, order).freeko[API, O] | |
} yield l | |
// Having problems with this code. Getting error message: | |
//[error] ../Introduction.scala:99: could not find implicit value for parameter lifter2: freek.Lifter2.Aux[cats.data.Xor[com.perevillega.trades.ErrorMessage,com.perevillega.trades.service.TradeApiTaskInterpreter.Ok],com.perevillega.trades.app.Introduction.O,A] | |
//[error] _ <- isVenueUp(venue).freeko[API, O] | |
// | |
// But if I replace the `Xor[ErrorMessage, List[Stock]]` from `VenueStocks` by `Xor[ErrorMessage, CustomCaseClass]` it's ok. | |
// | |
// Why? Shouldn't List just work? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment