You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solution:
I'll add a bytes method to the Index trait to simplify encoding and error handling. The new method will return the byte array as Either[Throwable, Array[Byte]], reducing the boilerplate code.
That's close, but I think if you were to write that code you'd find that it won't compile.
The return type of your code isn't an Array[Byte], it is a ByteVector, which is actually what we want.
Additionally, because FrequencyIndex and PositionalIndex have different Codecs, this would have to be abstract on the Index trait.
Unless we made an abstract def codec: Codec[Index] on the Index and then the bytes helper method could be concrete and leverage that.
That would work.
I'm happy to have you proceed, it just might not be as straightforward as you've initially sketched out.
Currently we get the
ByteVector
of anIndex
with something like:This feels like a lot of ceremony, let's add a
bytes
method to theIndex
trait that does this for us.The text was updated successfully, but these errors were encountered: