Here’s my line of thought:
When parsing data, key/value pairs are a rather common occurence, the two ones on my mind are JSON objects and command-line option lists. Radix trees may be used to make this parsing efficient, and the choice between strict/lazy tree representation is a whole separate box of fun.
There is however an extra flavor of a radix tree that is squarely outside of what GHC can do right now: a pre-compiled one. If the entire list of keys is known at compilation time , a
(forall a. [(String, a)] -> RadixTree a) conversion should should too be possible at compilation time.
I feel like GHC could track this “compilation-time’dness” in a way similar to tracking levity, via a separate type qualifier. All literals are known at compilation time, all functions only maintain the guarantee if every single argument is known at compilation time.
IO could be fully banned by making any related function only produce runtime-evaluated expressions, though there may be counterpoints to this.
Does anyone have strong opinions as to why this should/shouldn’t be possible?