News for hackers. Stuff that matters.
Re:What Is Good About Haskell? by magicalhippo on Thursday October 03, 2019 @02:13PM (#21150062)
Thanks for the response. Logging doesn't seem to be an issue then, nice.

I'm still curious as to how to introduce variations though.

Frequently we find that we have to introduce "if (settings['special_x']) then DoSpecial else DoCommon" deep in the business logic to handle special cases that arise.

Assuming the existing function did not depend on the settings, how does one best introduce this dependency on the settings? In our code base we can cheat by effectively having the "settings" dictionary as a global variable, though we try to minimize this obviously. But in a pinch at 4am, that might be enough.

How about Haskell, is there a way to "inject" such settings without refactoring all the way to the top?

Re:What Is Good About Haskell? by mbo on Thursday October 03, 2019 @06:22PM (#21152891)
If you're injecting your settings at the root of your reader monad (which almost all Haskell applications are structured around), how many function calls are you between your monad stack and where you need to thread settings to? 3? Maybe 4? This isn't an issue in practise. It's a 4 line diff.

Source: 3 years of pure FP Scala in prod

Re:What Is Good About Haskell? by h91wka on Thursday October 03, 2019 @03:17PM (#21150933)
unsafePerformIO will work. But again, why bother with side effect isolation, if you need to break it to do trivial stuff.