This makes sense in countries where education is publicly funded, it's there to broaden the knowledge and culture of the population. If you're having to take a huge loan to do it then you start having to do a ROI calculation.
2,459 karma · joined June 26, 2009
meet.hn/city/41.75786995,2.031182036159852/Barcelona
Socials: - github.com/opsb - linkedin.com/in/oliversearlebarnes
def main do
with {:ok, response} <- call_service(data),
{:ok, decoded} <- decode(response),
{:ok, result} <- store_in_db(decoded) do
:ok
end
end
where call_service, decode and store_in_db return the specific errors like {:error, :bad_request}, {:error, :conflict}. type Message
= IncrementBy Amount
| DecrementBy Amount
| Set Amount
type Amount = Amount Int
Obviously this is a contrived example - you wouldn't bother if you were dealing with an Int but once the message gets more complicated it can make sense. type Message
= IncrementBy Int
| DecrementBy Int
| Set IntRegarding sealed types, I'm not really sure why you'd choose these over type unions, in practice they're often used to describe things like events for reducers and using sealed is incredibly verbose compared to the equivalent in for instance typescript.
type Message =
| { type: 'IncrementBy', value: number }
| { type: 'DecrementBy', value: number }
| { type: 'Set', value: number };
vs sealed class Message {}
class IncrementBy extends Message {
final int value;
IncrementBy(this.value);
}
class DecrementBy extends Message {
final int value;
DecrementBy(this.value);
}
class Set extends Message {
final int value;
Set(this.value);
}
In a real app this noise really adds up making it difficult to get an overview of the types.Record types are nearly there, but currently there isn't a way to update the records which really hobbles them in day to day use (it looks there will be record spreading coming though so this is hopefully temporary).
[1] https://elixir-lang.org/blog/2022/10/05/my-future-with-elixi...