on my language wishlist is a language that makes it super easy to describe type level checklists. i think this sort of exists already but im not sure how clean it is.
like im thinking about opengl rn. shader programs will often have some global values, like positions for lights or cameras. each time you switch shaders you gotta configure whatever uniform data the program needs before you start using it to render objects. you can modify this data, but it is usually an error to not initialize it.
the naive fix is to wrap up all of opengl in something functional. each invocation of a shader program could have these values as parameters. which would totally work and make everything type safe but now you are sending data to the GPU for every single draw call. if you only need to configure the shader once and are gonna reuse the config on 1000 different objects then you are sending a lot of redundant info on the wire.
you could alternatively try to do some sort of reactive programming system, where you have the trad functional API but under the hood the program checks if there has been a state transition and skips the data upload if there isn't a change to the shader config. but this is pretty hard to get right. and i suspect it is really hard to get the compiler to eliminate all the checks for changed data at comptime, so there is still some runtime overhead
what seems like a nice lightweight alternative would be some kind of type level checklist. in order to run a shader program you need to provide evidence of initialization of each of the relevant uniform data fields. the signature for the shader execution would be something like `runShader : ShaderProgramID -> ProofThatLightingIsConfigured -> ProofThatCoordinateTransformIsConfigured -> IO ()`. in order to obtain evidence you'd have to run other programs, like `configureLighting : LightData -> IO ProofThatLightingIsConfigured`.
in principle all this evidence should be erasable at compile time. so no overhead. but it also guarantees that the shader is configured before it is used.
also opens the door to things like skipping the data upload. it is technically legit to skip configuration; opengl initializes unconfigured uniform buffers to predictable default values. but imo it's still good practice to be explicit. so you could add a `useDefaultLightingConfiguration : ProofThatLightingIsConfigured` and now it is clearly documented and checked by the type system that you wanna use the defaults.
i know there are things out there like this. idk ATS at all but i get the vibe that this is the sort of thing ATS is all about.
also seems probably pretty easy to implement a crude version of this with linear type systems + phantom types
otoh i don't see a lot of implementations of this sort of system and so that makes me wonder if there is a reason for that. given it doesn't seem terribly sophisticated i'd expect to see it show up places if it were actually useful
maybe the devex isn't that great? it kind of seems like modeling a state machine at the type level with a million phantom types could feel very cluttered. maybe with the right syntax support this would be useful?
or maybe its the kind of thing that you can get stuck admiring and improving your fancy type level model instead of getting work done. maybe its the sort of thing where the amount of time spent building the evidence management system eclipses the time spent debugging and so economy suggests not doing it
so idk maybe this is a dumb idea. but i really love checklists and so i imagine id love a good system for representing them at the type level