We came up with a way of reifying specifications of web APIs at the type level, and built a web framework around it. The basic idea was, I believe, first developed by Ralf Lämmel and Klaus Ostermann [0], as a Haskell solution to the expression problem, but I think it's the first large-scale application of these ideas.<p>Checking for correctness and deriving functionality from that comes pretty naturally after that, so it's easy to reduce boilerplate (e.g., generate client libraries and documentation automatically) and make static guarantees (e.g., that a link exists within an API, and won't 404).<p>[0] <a href="http://www.informatik.uni-marburg.de/~kos/papers/gpce06.pdf" rel="nofollow">http://www.informatik.uni-marburg.de/~kos/papers/gpce06.pdf</a>
Having the type-system statically verify that your API is correct and that your usage of it is correct, but oof, that syntax is quite hard to read. I wonder if you could use Template Haskell to generate that from an easier-to-read routes file similar to Yesod.