r/functionalprogramming • u/yughiro_destroyer • Mar 03 '26
Question Are flat and manually declared structs favored in FP ?
That, over doing things like... nesting structs, composing bigger structs out of smaller structs... and having functions to add/combine structs and gluecode to facilitate communication between them?
6
Upvotes
8
u/Inconstant_Moo Mar 03 '26
Not particularly. Why? The case for having your data modular is the same. If for example I have a struct which has a date in it, there's no upside to turning it into
day,month, andyearfields rather than having adatefield of typeDate. All the advantages of the latter course are still there.3
u/[deleted] Mar 03 '26
[removed] — view removed comment