Effect CommunityEC
Effect Community3y ago
3 replies
spaethnl

Consider Adding a Static Factory Method for Automatic Wrapping in an Effect

The documentation for the new class form in schema mentions that new MyModel(...) can throw. I wonder if it would be useful to have a default static factory method like
create
or parse to automatically wrap the creation process in an effect? This way you could do MyModel.create(...).map(). In the past (before schema), I have even made the constructor protected so that you are forced to use the factory method and therefore go through validation steps.

Or, do the existing parse functions work with classes?
Was this page helpful?