rjdellecese / gleam_decode

Transform Erlang or Elixir data into Gleam data
Apache License 2.0
26 stars 7 forks source link

Add decoder for ok/error tuples #4

Closed rjdellecese closed 4 years ago

rjdellecese commented 4 years ago

Add a function to reduce the boilerplate involved in decoding {ok, Success} and {error, Failure} tuples (that's {:ok, success} and {:error, failure} in Elixir).

There are variants of this kind of data that it might be helpful to have helpers for decoding too, e.g.

ok | error
{ok, Success} | error
ok | {error, Failure}

But I think that this is the most common one? Hopefully the potential value of other helper decoders can be assessed through use and user feedback!