DEV Community

Discussion on: Dependency injection in functional programming

Collapse
 
carstenk_dev profile image
Carsten

some of the problems you noticed with Reader vanish if you use functions like withReaderT

overall much of this is a problem of composing getters/setters - one of the answers to that is lenses/optics and so maybe you'll find this lens-module interesting too (deals with Readers)

Of course in languages like Elm or F# this might not be an option but Scala, PureScript and - I think - Kotlin with Arrow you might get lucky ;)

Collapse
 
psfeng profile image
Pin-Sho Feng

Hey Carsten, thanks for the feedback. Could you please provide an example of how withReaderT would solve those problems?