Protocols vs interfaces

Not sure I get your scenario. If f.ex. your credentials store is hitting the network your beautiful abstraction falls apart because you’ll either have to add handling of network errors or you’ll opt for ignoring errors. The former is OK but it might be an overkill if there’s also an alternative implementation with plain functions, the latter is definitely bad.

IMO the way to go here is to draw some lines and boundaries first.

There’s nothing wrong with that. Having some OOP by emulating and limiting it is what an ideal OOP looks like to me. Full-fledged OOP is too much for most tasks, especially in an FP language.

1 Like