InfixDeclaration.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE HTML>
  2. <html><head><meta charset="utf-8"><title>InfixDeclaration</title><link rel="stylesheet" href="Agda.css"></head><body><pre class="Agda"><a id="1" class="Background">\documentclass{article}
  3. \usepackage{agda}
  4. \begin{document}
  5. </a><a id="62" class="Markup">\begin{code}</a>
  6. <a id="75" class="Keyword">module</a> <a id="82" href="InfixDeclaration.html" class="Module">InfixDeclaration</a> <a id="99" class="Keyword">where</a>
  7. <a id="106" class="Keyword">infix</a> <a id="112" class="Number">5</a> <a id="114" href="InfixDeclaration.html#130" class="Datatype Operator">_&gt;&gt;_</a> <a id="119" href="InfixDeclaration.html#152" class="Datatype Operator">_&lt;&lt;_</a>
  8. <a id="125" class="Keyword">data</a> <a id="_&gt;&gt;_"></a><a id="130" href="InfixDeclaration.html#130" class="Datatype Operator">_&gt;&gt;_</a> <a id="135" class="Symbol">:</a> <a id="137" href="Agda.Primitive.html#311" class="Primitive">Set</a> <a id="141" class="Keyword">where</a>
  9. <a id="147" class="Keyword">data</a> <a id="_&lt;&lt;_"></a><a id="152" href="InfixDeclaration.html#152" class="Datatype Operator">_&lt;&lt;_</a> <a id="157" class="Symbol">:</a> <a id="159" href="Agda.Primitive.html#311" class="Primitive">Set</a> <a id="163" class="Keyword">where</a>
  10. <a id="170" class="Markup">\end{code}</a><a id="180" class="Background">
  11. Let&#39;s try some infix declaration with surrounding text.
  12. </a><a id="239" class="Markup">\begin{code}</a>
  13. <a id="252" class="Keyword">module</a> <a id="SurroundingText"></a><a id="259" href="InfixDeclaration.html#259" class="Module">SurroundingText</a> <a id="275" class="Keyword">where</a>
  14. <a id="282" class="Markup">\end{code}</a><a id="292" class="Background">
  15. In the following, we declare the fixity of two operators.
  16. </a><a id="353" class="Markup">\begin{code}</a>
  17. <a id="368" class="Keyword">infix</a> <a id="374" class="Number">5</a> <a id="376" href="InfixDeclaration.html#492" class="Postulate Operator">_+_</a> <a id="380" href="InfixDeclaration.html#496" class="Postulate Operator">_*_</a>
  18. <a id="384" class="Markup">\end{code}</a><a id="394" class="Background">
  19. A fixity declaration can precede the actual declaration of the names.
  20. </a><a id="467" class="Markup">\begin{code}</a>
  21. <a id="482" class="Keyword">postulate</a> <a id="SurroundingText._+_"></a><a id="492" href="InfixDeclaration.html#492" class="Postulate Operator">_+_</a> <a id="SurroundingText._*_"></a><a id="496" href="InfixDeclaration.html#496" class="Postulate Operator">_*_</a> <a id="500" class="Symbol">:</a> <a id="502" href="Agda.Primitive.html#311" class="Primitive">Set</a>
  22. <a id="506" class="Markup">\end{code}</a><a id="516" class="Background">
  23. Fixity declarations can also occur when renaming during import.
  24. </a><a id="583" class="Markup">\begin{code}</a>
  25. <a id="596" class="Keyword">open</a> <a id="601" href="InfixDeclaration.html#259" class="Module">SurroundingText</a> <a id="617" class="Keyword">renaming</a> <a id="626" class="Symbol">(</a><a id="627" href="InfixDeclaration.html#492" class="Postulate Operator">_+_</a> <a id="631" class="Symbol">to</a> <a id="634" class="Keyword">infixl</a> <a id="641" class="Number">5</a> <a id="643" class="Postulate Operator">_+_</a><a id="646" class="Symbol">;</a> <a id="649" href="InfixDeclaration.html#496" class="Postulate Operator">_*_</a> <a id="653" class="Symbol">to</a> <a id="656" class="Keyword">infixl</a> <a id="663" class="Number">10</a> <a id="666" class="Postulate Operator">_&amp;_</a><a id="669" class="Symbol">)</a>
  26. <a id="671" class="Markup">\end{code}</a><a id="681" class="Background">
  27. \end{document}
  28. </a></pre></body></html>