Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 26 2019 21:07
    scala-steward synchronize #139
  • Jan 26 2019 14:33

    mpilquist on v1.11.0

    (compare)

  • Jan 26 2019 14:32

    mpilquist on 1.11.x

    Setting version to 1.11.0 Updated version to 1.11.1-SNAPS… (compare)

  • Jan 25 2019 10:28
    billpcs starred scodec/scodec
  • Jan 22 2019 22:01
    benhanna starred scodec/scodec
  • Jan 21 2019 20:36
    scala-steward opened #139
  • Jan 21 2019 14:51
    mpilquist closed #130
  • Jan 21 2019 14:48
    mpilquist closed #119
  • Jan 21 2019 14:48
    mpilquist commented #119
  • Jan 21 2019 14:48

    mpilquist on 1.11.x

    Scala 2.13.0-M4 Merge branch 'series/1.10.x' in… Upgraded to latest scala-collec… and 2 more (compare)

  • Jan 21 2019 14:48
    mpilquist closed #138
  • Jan 21 2019 14:40
    mpilquist opened #138
  • Jan 21 2019 14:37

    mpilquist on 1.11.x

    Created 1.11 branch (compare)

  • Jan 21 2019 14:31

    mpilquist on xuwei-k

    Upgraded to 2.13.0-M5 (compare)

  • Jan 21 2019 14:19

    mpilquist on xuwei-k

    Scala 2.13.0-M4 Merge branch 'series/1.10.x' in… Upgraded to latest scala-collec… (compare)

  • Jan 21 2019 14:03

    mpilquist on 1.10.x

    Update sbt-scalajs, scalajs-com… Merge pull request #129 from sc… (compare)

  • Jan 21 2019 14:03
    mpilquist closed #129
  • Jan 21 2019 14:03
    mpilquist closed #126
  • Jan 21 2019 14:03

    mpilquist on 1.10.x

    Pad-left on pbcd codec. Fixes #… Using padLeft in pbcd instead o… Merge pull request #133 from lJ… (compare)

  • Jan 21 2019 14:03
    mpilquist closed #133
Soren
@srnb_gitlab
:: can do it on encoding, but that shouldn't be as hard
If you get :: working, then it might be feasible to get vector and etc working with a parTraverse mechanism, but those would quickly become a pain without reasonable error messages/tracing
I'd devote some of my time to getting that to work if I wasn't so busy :(
Last question: I have a Scala 3 enum, what's the best way to assign some sort of codec to each enum value?
Michael Pilquist
@mpilquist
i think mappedEnum codec
it's kinda boring but gets the job done :)
Soren
@srnb_gitlab
image.png
hmm
Soren
@srnb_gitlab
I think it's the object that's screwing things up here
I asked in lampepfl/dotty
Michael Pilquist
@mpilquist
oh it's a typo i think -- Elf vs Efi
Soren
@srnb_gitlab
Why the heck did I type Efi
Long week
Michael Pilquist
@mpilquist
lol
Soren
@srnb_gitlab
image.png
Michael Pilquist
@mpilquist
flip the order of the number and the enum value
Soren
@srnb_gitlab
awesome
Sick
Soren
@srnb_gitlab
How should I write a codec for the elf magic?
0x7F 'E' 'L' 'F'
(sorry for lying about the "last question" thing)
Michael Pilquist
@mpilquist
constant(hex"7f...")
Soren
@srnb_gitlab
Where can I find hex? @mpilquist which import?
Michael Pilquist
@mpilquist
import scodec.bits._
Soren
@srnb_gitlab
Awesome, ty
Artem Nikiforov
@nikiforo
I see https://github.com/typelevel/cats-parse have emerged.
Does scodec relates to the project in any way?
Are there any plan to relate scodec with cats-parse in some way?
Soren
@srnb_gitlab
@nikiforo Scodec is all about Codecs, which are invariant, whereas Parsers are Monads. Additionally, Parsers are String-based, while Codecs are ByteVector-based
Basically, scodec is meant to be a 1:1 thing for encoding/decoding data, while cats-parse is meant to be an n:1 for parsing text
Ryan Zeigler
@rzeigler
I'm interested in trying to write a parser for a complicated unframed network protocol. I poked around scodec-stream, but ultimately, I'm not trying to turn a stream of bits into a stream of messages but rather interact in specific ways. There doesn't seem to be a way to get at the coroutine bits inside of StreamDecoder to drive it myself. Is this correct?
Diego E. Alonso Blas
@diesalbla
@mpilquist Regarding scodec, several open-source projects (such as fs2) have migrated tests to munit, rather than scalatest or specs2, on account of it being a thinner library with a leaner development
Is that something you would also want in the pieces of scodec?
mpilquist
@mpilquist:matrix.org
[m]
scodec-bits, core, and protocols are already on munit, scodec-stream uses scalacheck only
Diego E. Alonso Blas
@diesalbla
? I was looking at scodec-bits series/1.1.x...
mpilquist
@mpilquist:matrix.org
[m]
look at main branch instead
Diego E. Alonso Blas
@diesalbla
... ok... thanks...
cranst0n
@cranst0n
I think maybe not, but is there any kind of combinator to deal with decoding values interleaved amongst others? Specific use case looks something like: [byte0][int24][int24][byte1][int24][int24]...[byte127][int24[int24]] and I want to decode all the ints into a list as well as bytes[0-127] into it's own custom type which has it's own codec.
I've got something working, but it's a rather convoluted xmap. Wondering if I'm somehow reinventing something.
mpilquist
@mpilquist:matrix.org
[m]
not sure it's any better but you could decode to a List[Either[Byte, Int]] and then use separate to turn that in to (List[Byte], List[Int])
cranst0n
@cranst0n
ill investigate to see how it fits. theres a few other steps involved but that's something i hadn't considered at the very least. thanks!
jilen
@jilen
Hi, how can I framing (param used by checksummed) a fixed(N bytes) + variableSizeBytes + checksum(1 byte) message?
Shubham Girdhar
@girdharshubham
Hi
I have a noob-ish question.
How do we write conditional codecs?
What I mean is, if the condition evaluates to true I decode a byte if it doesn't I don't.
I can put an if expression. but the type ultimately comes out as Codec[Nothing]
mpilquist
@mpilquist:matrix.org
[m]
take a look at scodec.codecs.conditional
Shubham Girdhar
@girdharshubham
Makes sense.
Thanks.
Kinda like this?
xCodec flatPrepend { (_: String, seqId: Int) =>
              conditional(seqId == 127, "PCM Id" | uint8L.withKey("pcmId"))
}
Thanks
btw withKey is just an xmap
Shubham Girdhar
@girdharshubham
Thanks @mpilquist
It works.
Rad Rares
@radRares1
Hello, do you know any good resources besides the documentation for someone who is just starting to learn how to use scodec? Thanks
mpilquist
@mpilquist:matrix.org
[m]
scodec-protocols has a bunch of "real world" examples
Rad Rares
@radRares1
thanks a lot!! :D