-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] Added PureCodec examples #9
base: master
Are you sure you want to change the base?
Conversation
|
||
|
||
// To handle exceptions automatically, we can use Try monad. Note that we get `EitherT(Failure(...))`, not | ||
// `EitherT(Failure(Right(...)))` as one might expect by analogy with previous examples. It's not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm not sure why this happens and it's pretty confusing to say the least.
} | ||
|
||
|
||
// TODO: describe `runF` and `toKleisli` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it seems the runF
example quoted on the readme page is off. When I've tried to use runF
accordingly to it, the compilation error has occurred. The code was:
val x = str2intCodec.direct.runF[Id]("foo")
println(x)
The error was:
[error] /Users/xdralex/Work/fluence/codec/examples/src/main/scala/fluence/codec/examples/PureCodecExample.scala:55:41: could not find implicit value for parameter F: cats.MonadError[cats.Id, _ >: fluence.codec.CodecError]
[error] val x = str2intCodec.direct.runF[Id]("foo")
[error] ^
[error] one error found
Not sure how the correct usage pattern should look like.
val codecs: KryoCodecs[Task, ::[Fuel, ::[Aircraft, ::[Array[Byte], ::[Long, ::[String, HNil]]]]]] = KryoCodecs() | ||
.addCase(classOf[Aircraft]) | ||
.add[Fuel] | ||
.build[Task]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how this Task
affects things later on.
Doesn't look like it's going to be pushed as a monad into the codecs being built...
No description provided.