Sometimes I have to use imperative languages like Python just because of the libraries that are available that aren’t available in the npm/PureScript or Haskell ecosystems (in my case, machine learning stuff). I’m wondering what folks here do when they have to write and maintain code in an imperative language? Do you try to twist the language to act like a functional programming language, or just give up and go with the idioms of the language?
In particular, I’m curious about effects. I love having
Aff to manage effectful code, but trying to accomplish the same in an imperative language can sometimes feel like I’m trying too hard to make the language into something it’s not. I’ve seen it done in “mostly” functional languages like async in F# and ZIO in Scala where there is good out-of-the-box support for monads, and I was surprised to read John A De Goes’ opinion that “effect tracking” is worthless without monads (if you trust my summary). Most imperative languages lack the capacity to conveniently work with monadic effect systems, so is senseless then to try to keep track of functions that can have side-effects or can fail? Can anyone point to any successes or failures when trying to separate out effectful code in a language without good support for monads?