InfixDeclaration.lagda 699 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. \documentclass{article}
  2. \usepackage{agda}
  3. \begin{document}
  4. \begin{code}
  5. module InfixDeclaration where
  6. infix 5 _>>_ _<<_
  7. data _>>_ : Set where
  8. data _<<_ : Set where
  9. \end{code}
  10. Let's try some infix declaration with surrounding text.
  11. \begin{code}
  12. module SurroundingText where
  13. \end{code}
  14. In the following, we declare the fixity of two operators.
  15. \begin{code}
  16. infix 5 _+_ _*_
  17. \end{code}
  18. A fixity declaration can precede the actual declaration of the names.
  19. \begin{code}
  20. postulate _+_ _*_ : Set
  21. \end{code}
  22. Fixity declarations can also occur when renaming during import.
  23. \begin{code}
  24. open SurroundingText renaming (_+_ to infixl 5 _+_; _*_ to infixl 10 _&_)
  25. \end{code}
  26. \end{document}