Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

[WIP] Added PureCodec examples #9

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

[WIP] Added PureCodec examples #9

wants to merge 4 commits into from

Conversation

xdralex
Copy link

@xdralex xdralex commented Jun 13, 2018

No description provided.

@xdralex xdralex requested a review from alari June 13, 2018 11:02


// 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
Copy link
Author

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`
Copy link
Author

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]()
Copy link
Author

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...

@folex folex marked this pull request as draft June 22, 2022 08:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant