Thanks for the feedback!
BurningWitness:
Okay, I had to spend 40 minutes figuring out what this is, and I’m still not sure.
Maybe the reference implementation in the next article (linked at the top of the current one) will help?
BurningWitness:
Am I correct to understand that the problem you’re looking to solve is that of a user-definable implicit global context, which can be adjusted locally,
Yes.
BurningWitness:
I assumed if a feature like this were to exist it’d be on the compiler to collect all the “contextual” references upfront.
I’m not sure what that means. Can you elaborate?
BurningWitness:
contextual x :: Contextual Int -- still magical contextual x = 5
FWIW, this is not allowed in my API. I suppose an API that allows it may be reasonable nonetheless.
BurningWitness:
This wouldn’t be mutable from user perspective, so I wouldn’t bring up
IORefat all when talking about it.
Why is it not “mutable from the user perspective”? The value of x “mutates” here, doesn’t it?
a <- getContextual x
print a
overriding x (+2) $ do
b <- getContextual x
print b