RsTHighlightCode.lagda.rst 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ****************
  2. RsTHighlightCode
  3. ****************
  4. ..
  5. Kenjiro:
  6. You're already dead!
  7. ::
  8. {-# OPTIONS --guardedness #-}
  9. module RsTHighlightCode where
  10. Shirou Emiya:
  11. People die when they're killed.
  12. ::
  13. data Bool : Set where
  14. true false : Bool
  15. Keine:
  16. I've been waiting for you.
  17. Challenging me on the night of a full moon...
  18. You sure have guts.
  19. ::
  20. record Colist (A : Set) : Set where
  21. coinductive
  22. constructor _::_
  23. field
  24. cohead : A
  25. cotail : Colist A
  26. Marisa:
  27. Good thing we're on a trial of guts anyway.
  28. .. code-block:: agda
  29. record R : Set where
  30. field x : X
  31. module M where x = ...
  32. r : R
  33. r = record { M; z = ... }
  34. Keine:
  35. You may not lay a single finger on her!
  36. ::
  37. open Colist
  38. postulate
  39. SomeSet : Set
  40. SomeVal : SomeSet
  41. Mokou:
  42. Even Night Sparrows are drowned in the silence of the forest...
  43. I wasn't expecting to meet any humans here.
  44. ::
  45. {-# NON_TERMINATING #-}
  46. non-terminating-code-blocks : Colist SomeSet
  47. non-terminating-code-blocks =
  48. SomeVal :: non-terminating-code-blocks
  49. Marisa:
  50. Who are you?
  51. ::
  52. open import Agda.Primitive
  53. variable i : Level
  54. Alice:
  55. Marisa, this girl...
  56. ::
  57. copattern-definitions : Colist SomeSet
  58. cohead copattern-definitions = SomeVal
  59. cotail copattern-definitions = copattern-definitions
  60. Mokou:
  61. I'm a human who's lived here for a long time...
  62. Don't worry, I'm not interested in eating you.
  63. ::
  64. import Agda.Builtin.List as List
  65. open List
  66. open import Agda.Builtin.Nat
  67. renaming (zero to O; suc to S)
  68. Marisa:
  69. Human? Doesn't look like one.
  70. ::
  71. cotake : {A : Set} -> Nat -> Colist A -> List A
  72. cotake O _ = []
  73. cotake (S n) as = cohead as ∷ cotake n (cotail as)
  74. Alice:
  75. Marisa, she's definitely human... but be careful.