Jan de Muijnck-Hughes<p>Revisiting the idea of 'Shaped Data' using <a href="https://discuss.systems/tags/dependent_types" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dependent_types</span></a> </p><p>The idea being that lots of standards (<a href="https://discuss.systems/tags/RFCs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>RFCs</span></a>) are encoded in <a href="https://discuss.systems/tags/XML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XML</span></a> for good reason. </p><p>Surprise, surprise:</p><p>What if we assume: <a href="https://discuss.systems/tags/XSD" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XSD</span></a> are <a href="https://discuss.systems/tags/types" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>types</span></a> and XML and <a href="https://discuss.systems/tags/XPath" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XPath</span></a> are values typed by XSD.</p><p>We can encode that nicely using dependent types so that we can write well-typed queries over well-typed data:</p><p>```<br>query : {ty : Schema n a} -> Query ty -> Data ty -> Maybe (Result ty)<br>```</p><p>Still, there are more things that can be well-typed. For example, I am gearing up to look at getting something like this working:</p><p>```<br>parse : {ty : Schema n a}<br> -> (str : String)<br> -> Rule (Data ty)<br>```</p>