Skip to content

Support for simple serialization to more generally useful typeΒ #13

@aarondl

Description

@aarondl

I was working with this library in order to implement bidirectional communication over grpc-web using a new elm protocol buffer library that makes use of this.

In order to get the bytes that the elm-protocol-buffers library created to the javascript library I used a port. But I found that taking this type from Elm to the outside world was sort of difficult.

In the end I used loop and unsignedUint8 to change it from Bytes.Bytes to List Int so I could throw it through the port at which point I had some thoughts:

  1. Given the state of Elm 0.19 with respect to kernel code in order to support more complicated protocols (grpc) the bytes type will almost certainly need to be given to a port so maybe it should become one of the natively supported pass-through types listed here: https://guide.elm-lang.org/interop/flags.html
  2. Even if the above is done it's probably still required to be able to serialize this to JSON easily. Though I understand that JSON has no native bytes representation so we'd have to pick our poison to solve that.
  3. In lieu of the above two options maybe just a built-in way to marshal between List Int and the Bytes type?

Appreciate any thoughts on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions