This needs some brainstorming on what the API should look like and how to balance ergonomics with type safety. TODO: add some strawman ideas