Haskell has a decent system for building up complex data structures. You can write functions for those. Those data structures + those functions are kind of "an object" from the OO world (data + methods).
The differences are:
* Inheritance - well Haskell has many kinds of polymorphism so it doesn't need it.
* Hiding data - well Haskell can hide data using smart constructors, you don't need an explicit private keyword
* Interfaces - covered by typeclasses but they do a lot more!
Also without any of the above you can create object-like things with just closures. If a scope has access to 3 variables in scope, it's "kinda" like an OO object with 3 member variables. You can create new scopes in a for loop, which is like creating many new object. It's a stretch but the underlying concept of something owning other things is still there.
> Those data structures + those functions are kind of "an object"
And in this setting, the type of that datastructure containing the functions can act as an interface.
A trap that OO programmers sometimes fall into with Haskell is to try to emulate OO interfaces using existential types + typeclass interfaces but that is a bit of an antipattern.
For things that naturally have complex statefulness ... like User Interfaces.
HTML DOM as a crude example, is a big 'tree of state' whereupon OO would lend well to the nature of the noes on that tree for example.
When you're crunching data and the entire process is literally some kind of transform FP I think more intuitively maps to the situation.
On the DB side, there is a niche of OODBs that exist and used particularly in networking because the persisted state there is really topological, in which case it doesn't always lend well to RDBMS.
Haskell has a decent system for building up complex data structures. You can write functions for those. Those data structures + those functions are kind of "an object" from the OO world (data + methods).
The differences are:
* Inheritance - well Haskell has many kinds of polymorphism so it doesn't need it.
* Hiding data - well Haskell can hide data using smart constructors, you don't need an explicit private keyword
* Interfaces - covered by typeclasses but they do a lot more!
Also without any of the above you can create object-like things with just closures. If a scope has access to 3 variables in scope, it's "kinda" like an OO object with 3 member variables. You can create new scopes in a for loop, which is like creating many new object. It's a stretch but the underlying concept of something owning other things is still there.