Conversation

Part of me is annoyed that await makes it too difficult to insert a benign effect somewhere without tagging tons of stuff async. Another part of me is annoyed that it is too easy to insert malignant effects everywhere just by haphazardly tagging tons of stuff async.
2
10
This is another reason I don't really believe that typeful programming will improve your designs. This code is TypeScript; somebody just willy-nilly added "async" and "await" until the thing type checked. The type system guided them towards doing exactly the wrong thing.
3
5
Like if every function in your Haskell program is inside an IO monad, tracking that in the type signature is not helping you. "At least it's explicit so you can have a conversation about it" you may think, and I would too, but then async/await goes and proves that's not true.
4
5
You can write shitty code in any language. Not sure what point you’re making about types here. As far as async/await goes, having to tag a function explicitly as await or not, with no other option, is a design choice of TS. One could easily imagine polymorphism over effects...
3
2
It seems to me like tools could also do a better job of automating mechanical changes like propagating “async”. That might also make it easier to iterate and judge changes. “If I introduce this effect here, how far does it infect the rest of my codebase?”
1
I think I want the opposite. I want to be able to say "during this dynamic extent, you may not read from the database." but then I'm sure some fool would just hoist all the pure logic out of that extent in order to intermingle it with the fetching logic one layer up.
1
3
I've thought about this too; there are a lot of "anti-effects" that you want to impose on subsets of your codebase, that a traditional effects system would force you to spread the inverse of across your entire code base
1
1
Like in Swift we want a "no realtime-unsafe calls" marker for critical sections to get the compiler to yell at you if it needs to malloc/take a lock/call a runtime function that might do one of those things
1
2
I think it's a bit different. Coeffects "turn the arrows around" but in the cases I'm thinking of, I think the things are still fundamentally effects, but it's more that you want to treat some effects as everywhere by default where they aren't explicitly disabled
3
1
Frank's ambient effect is basically this. By default, the ambient effect is empty but I think you should be able to change it to what you want. Kitten also has some defaulting like this IIRC.
1