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
I have been reading about Exceptional and I have already read the Medium blog post as well as the docs.
Namely, one thing jumped to my attention:
Exceptional.TaggedStatus
View Source
Convert back to conventional Erlang/Elixir {:ok, _} tuples
You seem to have the functionality "ToTaggetStatus", but I was unable to find anything to convert from it.
Example
Consider the following code:
#A bad JSON string we cannot decode into elixir
iex> bad_order_str = "{\"a\": 1, b: 2}"
"{\"a\": 1, b: 2}"
#A good JSON string we can decode into elixir
iex> good_order_str = "{\"a\": 1, \"b\": 2}"
"{\"a\": 1, \"b\": 2}"
#standard JSON encoder/decoder
iex> Jason.decode(bad_order_str)
# KABOOM
iex> Jason.decode(good_order_str) ~> IO.inspect
{:ok, %{"a" => 1, "b" => 2}}
Lets say I want to use JASON to encode and decode data. I am pretty much forced to use the bang (!) notation because Jason will give me a tagged tuple otherwise, thus defeating one of the main selling points of Exceptional (no more bangs!).
Alternatively, I have to make all my functions that pipe from functions returning tagged tuples to be able to cope with tagged tuples, which then forces me to use them throughout the rest of the code, which again defeats the purpose of using this library.
Questions
So, with this in mind, I am rather confused on how to proper use this library and if it fits my use case at all (involves a lot of JSON and side effects).
how do you handle tagged tuples in your code?
why don't you have a "FromTaggedStatus" module? (Is it because of the inconsistencies explained in your article?)
am I missing the true purpose/power of the library?
The text was updated successfully, but these errors were encountered:
Background
I have been reading about Exceptional and I have already read the Medium blog post as well as the docs.
Namely, one thing jumped to my attention:
You seem to have the functionality "ToTaggetStatus", but I was unable to find anything to convert from it.
Example
Consider the following code:
Lets say I want to use JASON to encode and decode data. I am pretty much forced to use the bang (
!
) notation because Jason will give me a tagged tuple otherwise, thus defeating one of the main selling points of Exceptional (no more bangs!).Alternatively, I have to make all my functions that pipe from functions returning tagged tuples to be able to cope with tagged tuples, which then forces me to use them throughout the rest of the code, which again defeats the purpose of using this library.
Questions
So, with this in mind, I am rather confused on how to proper use this library and if it fits my use case at all (involves a lot of JSON and side effects).
The text was updated successfully, but these errors were encountered: