Just had a little realization that part of my FP struggles right now is that I’m trying to design my systems as objects too much, still. I’ve always known this is part of the basic FP learning curve, but having a realization moment is good. I wish I could articulate the realization better but I’ll give this basic example:
Badpub type Storage(collection_type) {
StorailStorage(
read: fn(String) -> Result(collection_type, storail.StorailError),
write: fn(String, collection_type) -> Result(Nil, storail.StorailError)
)
/// ...more storage implementations
}
// Then you have to write the functions for each implementation and assign them to the created Storage record (pseudo-objects, btw)
This is bad because I’m basically just trying to make objects that contain methods. It’s right there, duh. However, I’m not sure what the idiomatic solution is. That’s where I’m wandering off to now…