Links.html 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE HTML>
  2. <html><head><meta charset="utf-8"><title>Links</title><link rel="stylesheet" href="Agda.css"></head><body><pre class="Agda"><a id="1" class="Background">\documentclass{article}
  3. \usepackage{hyperref}
  4. \usepackage[links]{agda}
  5. \begin{document}
  6. \AgdaTarget{ℕ}
  7. \AgdaTarget{zero}
  8. </a><a id="123" class="Markup">\begin{code}</a>
  9. <a id="136" class="Keyword">data</a> <a id="ℕ"></a><a id="141" href="Links.html#141" class="Datatype">ℕ</a> <a id="143" class="Symbol">:</a> <a id="145" href="Agda.Primitive.html#311" class="Primitive">Set</a> <a id="149" class="Keyword">where</a>
  10. <a id="ℕ.zero"></a><a id="157" href="Links.html#157" class="InductiveConstructor">zero</a> <a id="163" class="Symbol">:</a> <a id="165" href="Links.html#141" class="Datatype">ℕ</a>
  11. <a id="ℕ.suc"></a><a id="169" href="Links.html#169" class="InductiveConstructor">suc</a> <a id="175" class="Symbol">:</a> <a id="177" href="Links.html#141" class="Datatype">ℕ</a> <a id="179" class="Symbol">→</a> <a id="181" href="Links.html#141" class="Datatype">ℕ</a>
  12. <a id="183" class="Markup">\end{code}</a><a id="193" class="Background">
  13. See next page for how to define \AgdaFunction{two} (doesn&#39;t turn into a
  14. link because the target hasn&#39;t been defined yet). We could do it
  15. manually though; \hyperlink{two}{\AgdaDatatype{two}}.
  16. \newpage
  17. \AgdaTarget{two}
  18. \hypertarget{two}{}
  19. </a><a id="434" class="Markup">\begin{code}</a>
  20. <a id="two"></a><a id="447" href="Links.html#447" class="Function">two</a> <a id="451" class="Symbol">:</a> <a id="453" href="Links.html#141" class="Datatype">ℕ</a>
  21. <a id="455" href="Links.html#447" class="Function">two</a> <a id="459" class="Symbol">=</a> <a id="461" href="Links.html#169" class="InductiveConstructor">suc</a> <a id="465" class="Symbol">(</a><a id="466" href="Links.html#169" class="InductiveConstructor">suc</a> <a id="470" href="Links.html#157" class="InductiveConstructor">zero</a><a id="474" class="Symbol">)</a>
  22. <a id="476" class="Markup">\end{code}</a><a id="486" class="Background">
  23. \AgdaInductiveConstructor{zero} is of type
  24. \AgdaDatatype{ℕ}. \AgdaInductiveConstructor{suc} has not been defined to
  25. be a target so it doesn&#39;t turn into a link.
  26. \newpage
  27. Now that the target for \AgdaFunction{two} has been defined the link
  28. works automatically.
  29. </a><a id="750" class="Markup">\begin{code}</a>
  30. <a id="763" class="Keyword">data</a> <a id="Bool"></a><a id="768" href="Links.html#768" class="Datatype">Bool</a> <a id="773" class="Symbol">:</a> <a id="775" href="Agda.Primitive.html#311" class="Primitive">Set</a> <a id="779" class="Keyword">where</a>
  31. <a id="Bool.true"></a><a id="787" href="Links.html#787" class="InductiveConstructor">true</a> <a id="Bool.false"></a><a id="792" href="Links.html#792" class="InductiveConstructor">false</a> <a id="798" class="Symbol">:</a> <a id="800" href="Links.html#768" class="Datatype">Bool</a>
  32. <a id="805" class="Markup">\end{code}</a><a id="815" class="Background">
  33. The AgdaTarget command takes a list as input, enabling several targets
  34. to be specified as follows:
  35. \AgdaTarget{if, then, else, if\_then\_else\_}
  36. </a><a id="963" class="Markup">\begin{code}</a>
  37. <a id="if_then_else_"></a><a id="976" href="Links.html#976" class="Function Operator">if_then_else_</a> <a id="990" class="Symbol">:</a> <a id="992" class="Symbol">{</a><a id="993" href="Links.html#993" class="Bound">A</a> <a id="995" class="Symbol">:</a> <a id="997" href="Agda.Primitive.html#311" class="Primitive">Set</a><a id="1000" class="Symbol">}</a> <a id="1002" class="Symbol">→</a> <a id="1004" href="Links.html#768" class="Datatype">Bool</a> <a id="1009" class="Symbol">→</a> <a id="1011" href="Links.html#993" class="Bound">A</a> <a id="1013" class="Symbol">→</a> <a id="1015" href="Links.html#993" class="Bound">A</a> <a id="1017" class="Symbol">→</a> <a id="1019" href="Links.html#993" class="Bound">A</a>
  38. <a id="1021" href="Links.html#976" class="Function Operator">if</a> <a id="1024" href="Links.html#787" class="InductiveConstructor">true</a> <a id="1029" href="Links.html#976" class="Function Operator">then</a> <a id="1034" href="Links.html#1034" class="Bound">t</a> <a id="1036" href="Links.html#976" class="Function Operator">else</a> <a id="1041" href="Links.html#1041" class="Bound">f</a> <a id="1043" class="Symbol">=</a> <a id="1045" href="Links.html#1034" class="Bound">t</a>
  39. <a id="1047" href="Links.html#976" class="Function Operator">if</a> <a id="1050" href="Links.html#792" class="InductiveConstructor">false</a> <a id="1056" href="Links.html#976" class="Function Operator">then</a> <a id="1061" href="Links.html#1061" class="Bound">t</a> <a id="1063" href="Links.html#976" class="Function Operator">else</a> <a id="1068" href="Links.html#1068" class="Bound">f</a> <a id="1070" class="Symbol">=</a> <a id="1072" href="Links.html#1068" class="Bound">f</a>
  40. <a id="1074" class="Markup">\end{code}</a><a id="1084" class="Background">
  41. \newpage
  42. Mixfix identifier need their underscores escaped:
  43. \AgdaFunction{if\_then\_else\_}.
  44. \end{document}
  45. </a></pre></body></html>